Question: Consider the following database schema and then write the requested queries. AUTHOR ( id , name, address, country, age ) BOOK ( isbn , title,

Consider the following database schema and then write the requested queries.
AUTHOR (id, name, address, country, age)
BOOK (isbn, title, num-pages, publisher, year, genre, price)
WRITES(a-id, b-isbn)
SALES (isbn, year, num-copies)
The underlined attribute(s) form the key of the relation. Attribute isbn in SALES is a foreign key to BOOK. Attribute a-id is a foreign key to AUTHOR, and b-isbn is a foreign key to BOOK. Note that an author may have written several books (alone or with other authors), and that a book may have one or several authors. The table SALES gives the total number of copies sold by a certain book in a given year.
List the authors who have published a horror book and a sci-fi book
List the ids of authors who have written two or more books.
List the total sales per book, across years, with books identified by title.
Find the average number of books sold per year, for each year
Find the title of the most expensive book of 2015.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!