Question:
Consider the following relations (primary keys are underlined):
AUTHOR (ANo, aname, address, speciality)
PUBLISHER (PNo, pname, Location)
BOOK (BNo, Title, ISBN, PNo, Edition)
WRITES (BNo, ANo, ReleasedDate)
Where
AUTHOR contains author details and ANo (Author Number) is the primary key, aname stands for Author NAme. PUBLISHER contains publisher details and PNo (Publisher Number) is the primary key, pname stands for Publisher Name . BOOK contains details of the book and its primary key is Bno (Book Number).
Express the following queries in SQL:
(a) Write SQL code that will create the WRITES table. Choose appropriate data type and field size. Your answer should show the Primary key and Foreign key constraint. Make any assumption if possible.
(b) Write SQL code which will insert a row in the publisher table. Choose appropriate data value for the record.
(c) List all the titles published by Pitman?
(d) List all the speciality of all authors publishing a book with MIT Press.
(e) List the location of the publisher who published the book 'A guide to DB2'?
(f) List the names of all publishers publishing any book written by Smith or Jones.
(g) Gives the names of all publishers who have not published a book by Jones?