选择数据库school
use school
查询所有学生的学号、姓名和年龄,查询结果列项是中文名
select
sno 学号,
sname as 姓名,
年龄 = sage
from Student
查询‘计算机’系的所有学生的基本信息
select *
from Student
where sdept='计算机'
查询所有女同学的姓名及所在的系,显示结果不允许重复出现
select distinct sname,sdept
from Student
where sex='女'
查询课程号不为‘1’、‘4’、或‘7’的课程的信息
select *
from Course
where cno!=1 and cno!=4 and cno!=7
查询课程号不为‘1’、‘4’、或‘7’的课程的信息
select *
from Course
where cno not in('1','4','7')
查询所有姓‘张’、或‘刘’或‘高’的学生信息
select *
from Student
where sname like '张%' or sname like '高%' or sname like '刘%'
查询前10条学生信息
select top 10 *
from Student
查询成绩在80-90之间的所有学生成绩记录
select *
from SC
where grade between 80 and 90
查询成绩在80-90之间的所有学生成绩记录
select *
from SC
where (grade >= 80 and grade <=90)