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

原文地址:https://www.cnblogs.com/gester/p/4866380.html