sqlserver 数据简单查询

时间:2021-09-14 04:35:14
 1 use StudentManageDB
 2 go
 3 select StudentName as 姓名,Gender as 性别,出生日期=birthday
 4 from Students where Gender=''
 5 
 6 select 姓名=StudentName,地址和电话=StudentAddress+''+PhoneNumber+'' 
 7 from Students where Gender=''
 8 
 9 select 总成绩=CSharp+SQLServerDB from ScoreList
10 
11 select * from ScoreList
12 insert into ScoreList(StudentId,CSharp) values(100009,78)
13 
14 select * from ScoreList where SQLServerDB is null
15 
16 
17 select StudentName as 姓名,Gender as 性别,出生日期=birthday,所在学校='北京大学'
18 from Students where Gender=''
19 
20 select top 5 StudentName,Gender,Birthday from Students
21 
22 select top 20 percent StudentName,Gender,Birthday from Students
23 
24 select StudentId,(CSharp+5) as C#,DB=SQLServerDB
25 from ScoreList where (CSharp+5)>90
26 order by CSharp ASC
27 
28 select StudentId,(CSharp+5) as C#,DB=SQLServerDB
29 from ScoreList where (CSharp+5)>90
30 order by CSharp DESC
31 
32 select top 3 StudentId,CSharp as C#,DB=SQLServerDB
33 from ScoreList  
34 where StudentId not in(select top 6 StudentId from ScoreList order by SQLServerDB DESC,CSharp DESC )
35 order by SQLServerDB DESC,CSharp DESC
36 
37 select StudentId,CSharp as C#,DB=SQLServerDB
38 from ScoreList  
39 order by SQLServerDB DESC,CSharp DESC