SN CHAR(30),
SA INT
);
2) CREATE TABEL Course(
Cno INT PRIMARY KEY,
CN CHAR(30),
CT CHAR(30)
);
3) CREATE TABEL SC(
Sno INT,
Cno INT,
G INT,
PRIMAYR KEY(Sno,Cno),
FOREIGN KEY(Sno) REFERENCES Student(Sno)
FOREIGN KEY(Cno) REFERENCES Course(Cno)
);
2.1) GRANT INSERT, UPDATE, ON Student TO 赵华;
2) INSERT INTO Student
(TABLE (01001,‘赵华'',19),
(01002,’李芳‘,18),
(01003,’刘红‘,20),
);
3) UPDATE Student
SET SA=SA+1;
3.SELECT SN,G
FROM Student,Course,SC
WHERE Student.Sno=SC.Sno AND Course.Cno=SC.Cno
AND Course.CN=’数据库‘
ORDER BY G DESC,Sno;
4.R1 X Y Z
a c 5
b d 3
m e 4
4 d 8
5.1) 说明:EXEC SQL BEGIN DECLARE SECTION;
int sno;
char sname[30];
int sage;
char SQLSTATE[6];
EXEC SQL END DECLARE SECTION;
2) 赋值:sno:=01001;
sname:=’赵华‘;
sage:=19;
3) 插入:EXEC SQL INSERT
INTO Student
VALUES(:sno,:sname,:sage);
6.1)
2) 商店(商店号,商店名,地址)商店号→商店名,地址
商品(商品号,商品名,单价)商品号→商品名,单价
销售(商店号,商品号,数量,日期)商店号,商品号→数量,日期
7.1) π BN,SN(σ LNo=L4(BLBSS))
2) SELECT BN,SN
FROM B,LBS,S
WHERE B.BNo=LBS.BNo AND LBS.SNo=S.SNo
AND LBS.LNo=L4;