标签:ali values width ica primary mat src order 学习记录
搭建的表结构 | 要求说明: |
挑战参考代码
1 $ sudo service mysql start 2 3 $ mysql -u root 4 5 mysql> CREATE DATABASE gradesystem; 6 7 mysql> use gradesystem 8 9 mysql> CREATE TABLE student( 10 -> sid int NOT NULL AUTO_INCREMENT, 11 -> sname varchar(20) NOT NULL, 12 -> gender varchar(10) NOT NULL, 13 -> PRIMARY KEY(sid) 14 -> ); 15 16 mysql> CREATE TABLE course( 17 -> cid int NOT NULL AUTO_INCREMENT, 18 -> cname varchar(20) NOT NULL, 19 -> PRIMARY KEY(cid) 20 -> ); 21 22 mysql> CREATE TABLE mark( 23 -> mid int NOT NULL AUTO_INCREMENT, 24 -> sid int NOT NULL, 25 -> cid int NOT NULL, 26 -> score int NOT NULL, 27 -> PRIMARY KEY(mid), 28 -> FOREIGN KEY(sid) REFERENCES student(sid), 29 -> FOREIGN KEY(cid) REFERENCES course(cid) 30 -> ); 31 32 mysql> INSERT INTO student VALUES(1,‘Tom‘,‘male‘),(2,‘Jack‘,‘male‘),(3,‘Rose‘,‘female‘); 33 34 mysql> INSERT INTO course VALUES(1,‘math‘),(2,‘physics‘),(3,‘chemistry‘); 35 36 mysql> INSERT INTO mark VALUES(1,1,1,80),(2,2,1,85),(3,3,1,90),(4,1,2,60),(5,2,2,90),(6,3,2,75),(7,1,3,95),(8,2,3,75),(9,3,3,85);
----说明:本材料采用在线实验室,只为了学习记录,无其他用途。
标签:ali values width ica primary mat src order 学习记录
原文地址:https://www.cnblogs.com/wenjun145/p/13125190.html