1. 程式人生 > >建立資料庫表格插入資料

建立資料庫表格插入資料

create table xs(
xh char(6) not null primary key,
xm char(8) not null,
zym char(10) null,
xb tinyint(11) not null default 1,
xsrq date not null,
zxf tinyint(1) null,
zp blob null,
bz text null)
engine = innodb;


create table xs_kc(
xh char(6) not null ,
kch int(4),
cj int(4),
xf int(4),
kcm char(20));



create table kc(
kch int(4) ,
kcm char(20),
kkxq int(2),
xs int(4),
xf int(4));


insert into xs values('15001','劉華','通訊工程',1,'1995-04-08',50,null,null),
('15002','張明','計算機',1,'1996-11-01',43,null,null),
('15003','王敏','計算機',0,'1996-08-24',49,null,null),
('15004','閆妍','通訊工程',0,'1997-02-14',53,null,null),
('15005','趙林','資訊管理',1,'1996-09-26',47,null,null),
('15006','張紅','通訊工程',0,'1995-12-30',55,null,null),
('15007','程新','資訊管理',1,'1998-01-18',40,null,null),
('15008','劉通','計算機',1,'1996-04-22',42,null,null),;



insert into xs_kc values('15001',101,86,null,'計算機基礎'),
('15001',101,86,null,'計算機基礎'),
('15001',102,78,null,'程式設計'),
('15001',103,91,null,'高等數學'),
('15002',101,79,null,'計算機基礎'),
('15002',102,82,null,'程式設計'),
('15002',103,85,null,'高等數學');




insert into kc values(101,'計算機基礎',1,68,5),
(102,'程式設計',2,80,4),
(101,'高等數學',2,78,6);
建立學生資訊表 學生課程表 課程資訊表