Table structure and sample data of student information database (stusys)

#1.

create database stusys;
use stusys;
create table StudentInfo
(
     sno char(6) not null primary key comment 'student number',
     sname char(8) not null comment 'name',
     ssex char(2) not null default 'male' comment 'gender',
     birthday date not null comment 'date of birth',
     specialty char(12) null comment 'professional',
     tc tinyint null comment 'professional points'
)comment 'student table 1';
use stusys;
insert into studentinfo
     values
     ​​(' 191001','Liu Qingquan','Male','1998-06-21','Computer',52),
     ('191002','Zhang Huiling','Female','1999-11-07','Computer ',50),
     ('191003','Feng Tao','Male','1999-08-12','Computer',52),
     ('196001','Dong Mingxia','Female','1999-05-02','Communication',50 ),
     ('196002','Li Qian','Female','1998-07-25','Communication',48), ('196003','
     Zhou Junwen','Male','1998-03-10' ,'Communication',52);
select * from studentinfo;

#2.

use stusys;
create table courseInfo
(
     cno char(4) not null primary key comment 'course number',
     cname char(8) not null comment 'course name',
     credit char(2) null comment 'credits'
)comment 'course schedule ';
use stusys;
insert into courseinfo
     values
     ​​('1004','database system','4'),
     ('1017','operating system','3'),
     ('4002','digital circuit',' 3'),
     ('8001','Advanced Mathematics','4'),
     ('1201','English','4');
select * from courseinfo;

#3.
use stusys;
create table scoreInfo
(
     sno char(6) not null comment 'student number',
     cno char(4) not null comment 'course number',
     grade tinyint null comment 'grade',
     primary key(sno,cno )
)comment 'Scoresheet';
use stusys;
insert into scoreinfo
     values
     ​​('191001','1004','95'),
     ('191002','1004','87'),
     ('191003','1004 ','93'),
     ('196001','4002','90'),
     ('196002','4002','79'),
     ('196004','4002','88'),
     ( '191001','8001','92'),
     ('191002','8001','88'),
     ('191003','8003','84'),
     ('196001','8001','87'),
     ('196002','8001',NULL),
     ('196004','8001','94'),
     ('191001','1201','92'),
     ('191002','1201','78'),
     ('191003','1201','93'),
     ('196001','1201','84'),
     ('196002','1201','76'),
     ('196004','1201','92');
select * from scoreinfo; 

#4.
use stusys;
create table teacherInfo
(
     tno char(6) not null primary key comment 'teacher number',
     tname char(8) not null comment 'name',
     tsex char(2) not null default 'male' comment ' gender',
     tbirthday date not null comment 'date of birth',
     title char(12) null comment 'title',
     school char(12) null comment 'college'
)comment 'teacher table';
use stusys;
insert into teacherinfo
     values
     ​​(' 100006','He Yijie','Male','1970-06-23','Professor','School of Computer Science'), ('100023','Sun Haoran','Male','
     1979-04-09', 'Professor','School of Computer'),
     ('400017','Li Yalan','Female','1988-11-04','Lecturer','School of Communication'),
     ('800028','Yuan Wanming','Male','1978-08-15','Associate Professor' ,'Mathematics Faculty'),
     ('120046','Liu Ying','Female','1976-12-15','Associate Professor','School of Foreign Languages');
select * from teacherinfo; 

#5.
use stusys;
create table lectureInfo
(  
     sno char(6) not null comment 'teacher number',
     cno char(4) not null comment 'course number',
     location char(10) null comment 'class location',
     primary key (sno,cno)
)comment 'lecture table';
use stusys;
insert into lectureinfo
     values
     ​​('100006','1004','2-311'),
     ('400017','4002','1-106') ,
     ('800028','8001','6-104'),
     ('120046','1201','6-215');
select * from lectureinfo; 

 

Guess you like

Origin blog.csdn.net/weixin_72075654/article/details/129685714