1
CREATE TABLE CUSTOMER1
(
CUSTOMERID VARCHAR2(2) NOT NULL,
FIRSTNAME VARCHAR2(50) NOT NULL,
LASTNAME VARCHAR2(50) NOT NULL,
PHONENUMBER VARCHAR2(50) NOT NULL,
BIRTHDATE DATE NOT NULL,
DRIVERLICENSENUMBER NUMBER,
STATUS VARCHAR2(50),
CREDITCARENUMBER NUMBER,
CONSTRAINT CustomerID_PK PRIMARY KEY(CUSTOMERID)
);
CREATE TABLE CCATEGORY
(
CATEGORYID INT NOT NULL,
CATEGORYNAME VARCHAR2(50) NOT NULL,
CONSTRAINT categoryID_pk PRIMARY KEY (CATEGORYID)
);
CREATE TABLE TAPE
(
TAPEID NUMBER(5) NOT NULL,
TAPETITLE VARCHAR2(200) NOT NULL,
RELEASEYEAR NUMBER(5) NOT NULL,
DATEPURCHASED DATE NOT NULL,
PRICE NUMERIC(5) NOT NULL,
RENTEDOUT VARCHAR2(20) NOT NULL,
RATING VARCHAR2(10) NOT NULL,
ACTIONONRETURN VARCHAR2(50) NOT NULL,
PRIMARY KEY(TAPEID),
CONSTRAINT FK_CATEGORYID FOREIGN KEY(CATEGORYID) REFERENCES CCATEGORY(CATEGORYID),
CONSTRAINT FK_RESERVEDBY FOREIGN KEY(CUSTOMERID) REFERENCES CUSTOMER(CUSTOMERID)
);
客戶,並CCategory表中創建當我嘗試創建TAPE表我得到以下錯誤:。SQL Error: ORA-00904: "CATEGORYID": invalid identifier
似乎無法弄清楚爲什麼我創建的客戶表,然後再嘗試創建磁帶表之前類別表。SQL錯誤:ORA-00904:「CATEGORYID」:無效的標識符」
我試過了,我仍然得到相同的錯誤。 – Suji
好的。讓我來運行它。 – Utsav
檢查更新的答案。問題在於你沒有在'TAPE'表格中定義'CATEGORYID'和'CUSTOMERID'。添加它,它會工作。 – Utsav