use SCT --SCT数据库 select C# from sc --从sc表中查询C# selectdistinct C# from sc --从sc表中查询C#并且过滤掉重复行 select top 3*from sc --从sc表中查询前三行的数据 select top 50percent*from sc --从sc表中查询前50%的数据 select s# as 学号,score as 分数 from sc --从sc表查询s#作为“学号”输出,score作为“分数”输出 select s#,C#,Score*1.50from sc --从sc中查询s#,c#,和score的1.5倍,注意此时score没有列名 select s#,C#,Score150 = score *1.50from sc --此时score*1.50的列名为Score150 select*from sc where score>=60--查询sc中score>=60的元组 select*from sc where score>=60and s#='123'--and查询sc中score>=60并且s#为123的元组 select*from sc where score>=60or score<=20--or查询 select*from sc where score between20and60 select*from sc where score>=20and score<=60--等效 select Cname,Chours from sc where Cname in('数据库','C语言') select Cname,Chours from sc where Cname notin('数据库','C语言') select*from sc where sname like'张%' select*from sc where sname notlike'张%'--%任意长的任意字符,_任意单个字符,[]指定范围内的单个字符,如[a-f]或者[abfr],[^]指定不在范围内的单个字符 select*from sc where sname isNULL--[not] is对空值判断