mysql创建表练习

mysql创建表练习_第1张图片

mysql创建表练习_第2张图片 

CREATE TABLE student  (
Id int(10) primary key auto_increment comment "学号",
Name varchar(20) not null comment "姓名",
Sex enum('M','F') default 'M' comment "性别",
Birth year(4) comment "出生年份",
Department varchar(20) not null comment "院系",
Address varchar(50) comment "家庭住址");


create table score(
Id int(10) primary key auto_increment comment "编号",
Stu_id int(10) references student(Id),
C_name varchar(20) comment "课程名",
Grade int(10) comment "分数"
);

 

 

你可能感兴趣的:(数据库,mysql,数据库)