CREATE TABLE Customers(
  CustID number(5,0),
  EmpID CHAR(1),
  Cust_Name varchar(20) not null,
  Cust_Address varchar(20) not null,
  Cust_City varchar(20) not null,
  Cust_State char(2) not null,
  Cust_Zipcode number(5,0) not null,
  Ship_Date date not null,
  Order_Date date not null,
  constraint ci_fk FOREIGN KEY (EmpID) references EMPLOYEES(EmpID),
  constraint ci_ck check (Ship_Date>Order_Date)
)

What's the problem?

有帮助吗?

解决方案

Employees table does not exist.

or EmpId is not a primary key.

Once I did these, my copy of the create statement worked.

其他提示

Chris said it.

Change CHAR to VARCHAR2 as CHAR should never be used. Also, number(5,0) is the same as NUMBER(5), so you can use that.

Verify that the Employees table exists.

Verify that the EmpID column in the Employees table is of the same datatype as in the Customers table.

Verify that the EmpID column in the Employees table is the primary key of the employee table.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top