如何在表格之间进行参考

时间:2018-10-07 11:48:09

标签: mysql

我是MySQL的初学者。.尝试做我的第一个参考,并且不能在Orakle的Live SQL上的MySQL工作台(错误3730)中运行它(缺少右括号)。这是我的代码:

CREATE TABLE Customer(
CustNo CHAR(4) NOT NULL,
CustName varchar(30) NOT NULL,
Adress varchar(20) NOT NULL,
Internal boolean NOT NULL,
Contact varchar(30) NOT NULL,
Phone INT(7) NOT NULL,
City varchar(10) NOT NULL,
State CHAR(2) NOT NULL,
Zip INT(6));

CREATE TABLE Facility(
FacNo CHAR(4) NOT NULL,
FacName varchar(30) NOT NULL,
CONSTRAINT FacilityPK PRIMARY KEY (FacNo) );

CREATE TABLE Location(
LocNo CHAR(4) NOT NULL,
FacNo CHAR(4) NOT NULL,
LocName VARCHAR(20) NOT NULL,
CONSTRAINT LocationFK FOREIGN KEY (FacNo) REFERENCES Facility (FacNo));

0 个答案:

没有答案