Question

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?

Was it helpful?

Solution

Employees table does not exist.

or EmpId is not a primary key.

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top