Miracle

有梦想就不会觉得苦。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

SQL别名的用法

Posted on 2011-06-08 22:39  gsky  阅读(2011)  评论(0编辑  收藏  举报
http://dev.csdn.net/article/65/65909.shtm SQL 里面最常用的命令是 SELECT 语句,用于检索数据。语法是: SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] * | expression [ AS output_name ] [, ...] [ INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table ] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY expression [, ...] ] [ HAVING condition [, ...] ] [ { UNION | INTERSECT | EXCEPT [ ALL ] } select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ] [ FOR UPDATE [ OF class_name [, ...] ] ] [ LIMIT { count | ALL } [ { OFFSET | , } start ]]*******************************************************************as 是select部分列的别名,就是把别名作为列名显示;而from里面的别名是不需要用as关键字的,直接写就可以例如:SELECT S.SNAME, P.PNAME FROM SUPPLIER S, PART P, SELLS SE WHERE S.SNO = SE.SNO AND P.PNO = SE.PNO;同时,看得出来,where子句里面是可以用缩写的。