当前位置: 首页 > news >正文

mysql为什么创建不了表_求教,,为什么创建不了表

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

create table classroom

(buildingvarchar(15),

room_numbervarchar(7),

capacitynumeric(4,0),

primary key (building, room_number)

);

create table department

(dept_namevarchar(20),

buildingvarchar(15),

budget numeric(12,2) check (budget > 0),

primary key (dept_name)

);

create table course

(course_idvarchar(8),

titlevarchar(50),

dept_namevarchar(20),

creditsnumeric(2,0) check (credits > 0),

primary key (course_id),

foreign key (dept_name) references department

on delete set null

);

create table instructor

(IDvarchar(5),

namevarchar(20) not null,

dept_namevarchar(20),

salarynumeric(8,2) check (salary > 29000),

primary key (ID),

foreign key (dept_name) references department

on delete set null

);

create table section

(course_idvarchar(8),

sec_idvarchar(8),

semestervarchar(6)

check (semester in ('Fall', 'Winter', 'Spring', 'Summer')),

yearnumeric(4,0) check (year > 1701 and year < 2100),

buildingvarchar(15),

room_numbervarchar(7),

time_slot_idvarchar(4),

primary key (course_id, sec_id, semester, year),

foreign key (course_id) references course

on delete cascade,

foreign key (building, room_number) references classroom

on delete set null

);

create table teaches

(IDvarchar(5),

course_idvarchar(8),

sec_idvarchar(8),

semestervarchar(6),

yearnumeric(4,0),

primary key (ID, course_id, sec_id, semester, year),

foreign key (course_id,sec_id, semester, year) references section

on delete cascade,

foreign key (ID) references instructor

on delete cascade

);

create table student

(IDvarchar(5),

namevarchar(20) not null,

dept_namevarchar(20),

tot_crednumeric(3,0) check (tot_cred >= 0),

primary key (ID),

foreign key (dept_name) references department

on delete set null

);

create table takes

(IDvarchar(5),

course_idvarchar(8),

sec_idvarchar(8),

semestervarchar(6),

yearnumeric(4,0),

grade varchar(2),

primary key (ID, course_id, sec_id, semester, year),

foreign key (course_id,sec_id, semester, year) references section

on delete cascade,

foreign key (ID) references student

on delete cascade

);

create table advisor

(s_IDvarchar(5),

i_IDvarchar(5),

primary key (s_ID),

foreign key (i_ID) references instructor (ID)

on delete set null,

foreign key (s_ID) references student (ID)

on delete cascade

);

create table time_slot

(time_slot_idvarchar(4),

dayvarchar(1),

start_hrnumeric(2) check (start_hr >= 0 and start_hr < 24),

start_minnumeric(2) check (start_min >= 0 and start_min < 60),

end_hrnumeric(2) check (end_hr >= 0 and end_hr < 24),

end_minnumeric(2) check (end_min >= 0 and end_min < 60),

primary key (time_slot_id, day, start_hr, start_min)

);

create table prereq

(course_idvarchar(8),

prereq_idvarchar(8),

primary key (course_id, prereq_id),

foreign key (course_id) references course

on delete cascade,

foreign key (prereq_id) references course

);

相关文章:

  • java目前主流框架_java的三大主流框架介绍
  • java elasticsearch_Java操作ElasticSearch
  • java 拆分xml_使用Java分割1GB Xml文件
  • a与a的共轭转置相乘_线性代数A矩阵乘以A的转置的含义或者几何意义
  • java 会话管理_java会话管理
  • JAVA中传值的语句_java中的传值方法。
  • java重新加载class_Java使用ClassLoader重新加载代码
  • flume java 安装部署_Flume安装与配置
  • java区块链技术web3j_【区块链】以太坊 web3j for java 使用 - 部署和调用合约 3
  • java exception message_Java 如何摆脱Exception.getMessage()输出带类名
  • dropzone java多文件_java zyUpload 实现多文件上传
  • linux ttyusb读写_如何在Linux上找到所有串行设备(ttyS,ttyUSB,..)而不打开它们?
  • 我的世界java无限水_我的世界:一桶水变成“无限水”的11种方法!真正属于老mc的技术...
  • 怎样把java降至7_JDK1.8降到1.7技巧
  • java中byte数组为参数,JAVA:PBEKeySpec带有字节数组参数,而不是ASCII