--选择查询 select 列名,列名 from 表名select athlete from king --精确匹配 select * from 表名 where 条件select * from king where country = '中国'--多条件 select * from 表名 where 条件 连接符(or and) 条件 --!!!列名不同 考虑and连接 列名相同 考虑or 连接select * from king where country ='中国' or country ='美国'--区域范围 用and 连接select * from king where getkingdate >'2008-08-09 12:00:00.000' and getkingdate <'2008-08-19 22:05:00.000'--排序查询 !!order by 是所有排序条件中优先级最低的,所以放最后 desc 降序select * from king where country = '中国'order by getkingdate asc--升序--截断排序 然后可以加条件判断select top 3 * from king select top 50 percent * from king --时间函数(高效)select GETDATE ()--当前时间select DATEDIFF (DAY ,'2000-01-01',GETDATE ())--计算现在离2000-01-01有多少天select DATEADD (DAY ,1314,GETDATE ())--加1314天select DATEPART (DAY ,GETDATE ())--获取系统时间的单位,日期select DATEPART (MINUTE,GETDATE())--获取系统时间的单位,分钟--其他照着画瓢