0
我剛剛學習SQL,當我嘗試創建「Order」表時,出現錯誤「缺少右括號」。當我刪除FK約束時,出現錯誤「無效標識符」SQL錯誤右鍵錯誤
DROP TABLE CUSTOMER;
CREATE TABLE CUSTOMER
(
CUST_ID INT PRIMARY KEY,
COMP_NAME VARCHAR(40),
CONT_LNAME VARCHAR(30),
CONT_FNAME VARCHAR(30),
PHONE VARCHAR(30),
EMAIL VARCHAR(40),
ADDRESS VARCHAR(40),
CITY VARCHAR(30),
ZIP NUMBER
);
INSERT INTO CUSTOMER (CUST_ID, COMP_NAME, CONT_LNAME, CONT_FNAME, PHONE, EMAIL, ADDRESS, CITY,ZIP) VALUES
(1,'Atomic Liqours','Signor','Rose','518-990-8765','[email protected]','76 Hackett Blvd','Albany','12204');
INSERT INTO CUSTOMER (CUST_ID, COMP_NAME, CONT_LNAME, CONT_FNAME, PHONE, EMAIL, ADDRESS, CITY,ZIP) VALUES
(2,'HBD Bar','Capozolli','Rose','889-908-6666','[email protected]','888 Project Rd','Troy','12180');
INSERT INTO CUSTOMER (CUST_ID, COMP_NAME, CONT_LNAME, CONT_FNAME, PHONE, EMAIL, ADDRESS, CITY,ZIP) VALUES
(3,'Lee Harvey','Smith','Seth','675-888-9999','[email protected]','78 Healy Ave','Troy','12222');
-- CREATING ORDER TABLE
CREATE TABLE ORDERS
(
ORD_ID INT PRIMARY KEY,
CUST_ID INT FOREIGN KEY REFERENCES Customers (CUST_ID),
ORD_DATE DATE,
DEL_DATE DATE,
);
我剛試過,但我仍然得到同樣的錯誤 – nbhuiya
嘗試刪除'外國KEY',所以行會看起來像: 'CUST_ID INT參考客戶(CUST_ID),' –
我收到錯誤無效標識符,如果我刪除了整行,我也會得到同樣的錯誤 – nbhuiya