I'm trying to create this simple table:
CREATE TABLE BOOKLENDED
(
LIBRARY_CARD_NUMBER INTEGER NOT NULL ,
FOREIGN KEY (LIBRARY_CARD_NUMBER) REFERENCES BORROWER (LIBRARY_CARD_NUMBER),
SEQUENCE INTEGER UNIQUE,
ISBN_NUMBER INT NOT NULL,
FOREIGN KEY (ISBN_NUMBER) REFERENCES BOOK(ISBN_NUMBER),
LIBRARIAN_ID INTEGER
RETURN_DATE DATE NOT NULL,
CHECKOUT_DATE DATE NOT NULL
)
And I'm having this error:
7: Unexpected token: INTEGER in statement [CREATE TABLE BOOKLENDED ( LIBRARY_CARD_NUMBER INTEGER NOT NULL , FOREIGN KEY (LIBRARY_CARD_NUMBER) REFERENCES BORROWER (LIBRARY_CARD_NUMBER),
SEQUENCE INTEGER]
You are trying to give two constraints(NOT NULL,FOREIGN KEY
) at a time. instead u can add the FOREIGN KEY
at the end: Try the follwing
CREATE TABLE BOOKLENDED
(
LIBRARY_CARD_NUMBER INTEGER NOT NULL ,
SEQUENCE INTEGER,
ISBN_NUMBER INT NOT NULL,
LIBRARIAN_ID INTEGER,
RETURN_DATE DATE NOT NULL,
CHECKOUT_DATE DATE NOT NULL,
UNIQUE (SEQUENCE),
FOREIGN KEY (LIBRARY_CARD_NUMBER) REFERENCES BORROWER (LIBRARY_CARD_NUMBER),
FOREIGN KEY (ISBN_NUMBER) REFERENCES BOOK(ISBN_NUMBER)
);