CREATE TABLE Book (
ISBN int NOT NULL,
Title varchar(255) NOT NULL,
year varchar(5),
price int,
PRIMARY KEY (ISBN)
);
CREATE TABLE Author (
Id int PRIMARY KEY,
name varchar(255) NOT NULL,
address varchar(50),
URL varchar(255)
);
CREATE TABLE Warehouse (
code int primary key,
phone int,
address varchar (50)
);
CREATE TABLE publisher (
Id int PRIMARY KEY,
URL varchar(255),
name varchar(255) NOT NULL,
address varchar(5)
);
CREATE TABLE Book_Author (
Id int ,
ISBN int,
FOREIGN KEY (ISBN) REFERENCES Book(ISBN),
FOREIGN KEY (Id) REFERENCES Author(Id),
primary key (ISBN,Id)
);
CREATE TABLE Book_warhouse (
ISBN int ,
code int,
copies int,
FOREIGN KEY (ISBN) REFERENCES Book(ISBN),
FOREIGN KEY (code) REFERENCES warehouse(code),
primary key (ISBN,code)
);
alter TABLE Book
add id int;
--alter TABLE Book
--add CONSTRAINT book_fk FOREIGN KEY (id) REFERENCES publisher(id);
--Insert into book (ISBN, Title, year, price) values (15783,'CS',2014,105)
--Insert into Author (Id, name, address, URL) values (5551,"samir","hadyek alkoba","https://[Log in to view URL]")
--Insert into Book_Author (Id, ISBN) values (5553, 15789)
--Insert into Warehouse (code, phone, address) values (7771, 01112353693, "almaadi")
--Insert into Book_warhouse (ISBN, code, copies) values (15789, 7771, 3)
--Update book
--set price =90
--where isbn = 15781;
To embed this project on your website, copy the following code and paste it into your website's HTML: