Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions