1.创建表
CREATE TABLE Student(
Sno INT(5) PRIMARY KEY,
Sname VARCHAR(20) UNIQUE,
Ssex ENUM('男','女'),
Sage INT(5),
Sdept VARCHAR(20) DEFAULT '计算机'
);
CREATE TABLE Course(
Cno INT(5) PRIMARY KEY,
Cname VARCHAR(20)
);
CREATE TABLE SC(
Sno INT(5),
Cno INT(5),
Score INT(10),
PRIMARY KEY(Sno,Cno)
);
2.
ALTER TABLE Student MODIFY Sage SMALLINT(5);
3.
ALTER TABLE SC ADD INDEX SC_INDEX(Sno,Cno);
4.
CREATE VIEW stu_info AS SELECT Student.`Sname` ,Student.`Ssex`,Course.`Cname`,SC.`Score` FROM Student,Course,SC;