Hi I am a newbie on the sql statement, i was given a small exercise through the book regarding sql statement, it was told something like :
The PUBLISHERS table will have the attributes ID (3 characters), name (maximum of 30 characters, and city (maximum of 10 characters). The BOOKS table will have the attributes ID (4 characters), title (maximum of 50 characters), author (maximum of 30 characters), publisher ID, and date published. Make reasonable assumptions for the data types of publisher ID and date published.
CREATE TABLE PUBLISHERS(
Publisher_ID int NOT NULL,
Name varchar(50) NOT NULL,
City varchar(50) NOT NULL,
CONSTRAINT PUBLISHERS_PK PRIMARY KEY(Publisher_ID));
CREATE TABLE BOOKS
(
Title varchar(50) NOT NULL,
Author varchar(30) NOT NULL,
DatePublish date NOT NULL,
Publisher_ID int NOT NULL,
CONSTRAINT Title_PK PRIMARY KEY(Title),
CONSTRAINT Publisher_ID FOREIGN KEY(Publisher_ID)
REFERENCES PUBLISHERS(Publisher_ID));
Can any expert(s) advice me on the exercise against my answer, I am so exciting to wait for some one to correct me.
