SQL-基础SQL语言-建表和插入数据

--创建Student表--
create table Student
(
    Sno char(10) primary key,
    Sname varchar(20),
    Ssex char(2),
    Sage smallint,
    Sdept varchar(20)
);
--创建Course表--
create table Course
(
    Cno char(10) primary key,
    Cname varchar(20),
    Cpno char(10),
    Ccredit smallint
);
--创建SC表--
create table SC
(
    Sno char(10),
    Cno char(10),
    Grade smallint,
    primary key(Sno,Cno)
);

--001性别女,专业计算机科学
insert into Student values(001,MuHuai,f,20,JiSuanJi);
--002性别男,专业音乐
insert into Student values(002,木槐,m,19,YinYue);
insert into Student values(003,LinGui,f,20,ShengWu);
insert into Student values(004,林鬼,m,18,ShuXue);
insert into Student values(005,Niki,f,18,JiSuanJi);
insert into Student values(006,Charles,m,18,YingYu);
insert into Student values(007,Smith,m,19,YingYu);
insert into Student values(008,PiPe,m,21,ShuXue);
insert into Student values(009,烟斗,f,19,ShengWu);
insert into Student values(010,gong,m,21,China);
insert into Student values(011,shang,f,19,China);
insert into Student values(012,jue,f,21,China);
insert into Student values(013,zhi,m,18,China);
insert into Student values(014,yu,m,20,China);
insert into Student values(015,contton,f,2000,China);

--课程艺术C01
insert into Course values(C01,HuaHua,AC01,3);
insert into Course values(C02,TiYu,AC02,2);
insert into Course values(C03,ZhengZhi,AC03,10);
insert into Course values(C04,YuWen,AC04,10);
insert into Course values(C05,SiXiang,AC05,3);
insert into Course values(C06,XiJu,AC06,6);
insert into Course values(C07,ShuXue,AC07,3);
insert into Course values(C08,YingYu,AC08,2);
insert into Course values(C09,ShengWu,AC09,4);
insert into Course values(C10,WuLi,AC10,5);

--001学生C01课程
insert into SC values(001,C01,97);
insert into SC values(001,C02,86);
insert into SC values(002,C03,67);
insert into SC values(002,C02,98);
insert into SC values(003,C04,35);
insert into SC values(003,C03,63);
insert into SC values(004,C02,56);
insert into SC values(004,C04,78);
insert into SC values(005,C06,97);
insert into SC values(005,C04,26);
insert into SC values(006,C03,92);
insert into SC values(006,C02,87);
insert into SC values(007,C07,100);
insert into SC values(007,C02,14);
insert into SC values(008,C08,100);
insert into SC values(008,C03,38);
insert into SC values(009,C10,89);
insert into SC values(009,C05,59);
insert into SC values(010,C02,96);
insert into SC values(010,C01,94);
insert into SC values(011,C02,74);
insert into SC values(011,C03,86);
insert into SC values(012,C09,0);
insert into SC values(012,C10,0);
insert into SC values(013,C08,100);
insert into SC values(013,C04,93);
insert into SC values(014,C03,73);
insert into SC values(014,C07,69);
insert into SC values(015,C10,100);
insert into SC values(015,C09,0);
insert into SC values(001,C03,0);
insert into SC values(002,C06,91); 
insert into SC values(003,C10,0);
insert into SC values(004,C03,100);
insert into SC values(005,C10,0);
insert into SC values(006,C10,100);
insert into SC values(007,C10,0);

 

SQL-基础SQL语言-建表和插入数据

上一篇:mysql重启服务后,pymsql报错InterfaceError: 2013: Lost connection to MySQL server during query


下一篇:Debian无法通过ssh连接