内容发布更新时间 : 2025/1/9 19:48:27星期一 下面是文章的全部内容请认真阅读。
1. SELECT *
FROM Student 结果:
2. SELECT Sname 姓名,Sage 年龄
FROM Student
WHERE Sdept='计算机系' 结果:
3. SELECT Sno 学号,Cno 课程号,Grade 成绩
FROM SC
WHERE Grade BETWEEN 70 AND 80
4. SELECT Sname 姓名,Sage 年龄
FROM Student
WHERE Sdept='计算机系' AND Sage>=18 AND Sage<=20 AND Ssex='男'
5. SELECT MAX(Grade) 最高分数
FROM SC
WHERE Cno='c01'
6. SELECT MAX(Sage) 最大年龄,MIN(Sage) 最小年龄
FROM Student
WHERE Sdept='计算机系'
7. SELECT Sdept 系名,COUNT(*) 学生人数
FROM Student GROUP BY Sdept
8. SELECT Cname 课程名,COUNT(*) 选课门数,MAX(Grade) 最高分
FROM Course,SC GROUP BY Cname
9. SELECT Sno 学号,COUNT(*) 选课门数,SUM(Grade) 总成绩
FROM SC GROUP BY Sno
ORDER BY'选课门数' ASC
10. SELECT Sno 学号,SUM(Grade) 总成绩
FROM SC GROUP BY Sno
HAVING SUM(Grade)>200
10.
CREAT TABLE BOOK(
Snobook nchar(6) PRIMARY KEY, Snamebook nvarchar(30) NBOT NULL, Writer char(10) NOT NULL, Time smalldatetime, Price numeric(3,1) )
CREAT TABLE BOOKSHOP(
Snoshop nchar(6) PRIMARY KEY, Snameshop nvarchar(30) NOT NULL, Tel char(8)CHECK(Tel =0 AND Tel <=9), Place nchar(40), Snoemail char(6) )
CREAT TABLE BOOKSELL( Snobook nchar(6) NOT NULL,