Part 5 Select statement in sql server

Select specific or all columns

select * from 表名
select * from Student

select 列名,列名... from 表名
select name,age,email from Student

Distinct rows
select distinct 列名 from 表名
select distinct name from Student

Filtering with where clause(子句)
select * from Student where age>18

Wild Cards in SQL Server
Joining multiple conditions using AND and OR operators
select * from Student where age>18 and name like 'gester%' or gender=1

Sorting rows using order by
select name,email from Student 
order by name

Selecting top n or top n percentage of rows
select top 10 * from Student

posted @ 2015-10-10 11:55  Gester.Lin  阅读(182)  评论(0编辑  收藏  举报