(1)寫出建立該表的sql語句
(2)找出nickname為qq的用戶,按id降序排列的sql語句
(3)寫出刪除id為1234用戶記錄的sql語句
(4)寫出添加id為5555,nickname為’1234′的sql語句
答案:
(1)CREATE TABLE tableqq(

id int not null,
nickname char(20) not null)
(2)SELECT * FROM tableqq WHERE nickname = 'qq' ORDER BY id DESC
(3)DELETE FROM tableqq WHERE id = 1234
(4)INSERT INTO tableqq VALUES(5555,'1234')

2. 有關系 s(sno,sname) c(cno,cname) sc(sno,cno,grade)
1 問上課程 “db”的學生
select s1.sname from s s1,c c1,sc sc1 where s1.sno = sc1.sno and sc1.cno = c1.cno and c1.cname = 'db'
2 成績最高的學生號
select sno,max(grade) from sc group by sno
3 每科大于90分的人數
select cno,count(sno) from sc where grade > 90 group by cno;