sqlserver学习札记

来源:互联网 发布:mastercam9.1编程全集 编辑:程序博客网 时间:2024/06/03 22:54

项目中用的一直是hhs,所以很少接触sql语句,闲来无事就总结一下平时常用的sql语句:

1、关键字:create update alter drop insert exec  select  declare open fetch close if while case when where union 

max avg min data as group by order by having 

2、简单查询

   select * from table 

   条件查询

   select * from table where 

   字表查询

   select  a.field1 ,b.field1 from table1 a,table2 b where a.id=b.name

  分组查询

  select Name ,max(column) from table group by Name union view 

 

3、组合查询