常用查询方式:
- select * from tablename
- select col1,clo2 from tablename where age = 18
- select col1,clo2 from tablename where age >=18 and age<=60
- select col1,clo2 from tablename where age between 18 and 60
- select top(100) col1,clo2 from tablename where age between 18 and 60
- select top(100) col1,clo2 from tablename where age is null
- select top(100) col1,clo2 from tablename where age is not null
- select top(50)percent col1,clo2 from tablename where age
- 。。。。。。
--case when select top(100) student_id, student_name, case when student_age <18 then '未成年:' + CONVERT(varchar(50),student_age)+'岁' when student_age>=18 and student_age<100 then '成年人:'+ CONVERT(varchar(50),student_age)+'岁' else '100以上高寿老人'+ CONVERT(varchar(50),student_age)+'岁' end as '是否成年人', student_sex from [dbo].[student] order by student_age desc
