資料庫 建立 3表

wu33169發表於2024-08-27

1 create table student(stu_no int,stu_name varchar(10), sex char(1),
age int(3),
edit varchar(20) )
DEFAULT charset=utf8;
insert into student values(1,'wang','男',21,'hello'),
(2,'小明','女',22,'haha2'), (3,'hu','女',23,'haha3'),
(4,'li','男',25,'haha4');

2create table course( c_no int,c_name varchar(10))
DEFAULT charset=utf8;
insert into course values(1,'計算機原理'), (2,'java'),
(3,'c'),(4,'php'), (5,'py');

rop table sc;

3 create table sc( sc_no int,
stu_no int, c_no int,
score int(3))
DEFAULT charset=utf8;
insert into sc values
(1,1,1,80),
(2,2,2,90), (3,2,1,85), (4,2,3,70),
(5,2,4,95),(6,2,5,89);

相關文章