Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following questions as queries (SELECT statements) in SQL. Use only the operators discussed in class (SELECT, FROM, WHERE, GROUP BY, HAVING, CASE, subqueries).

Write the following questions as queries (SELECT statements) in SQL. Use only the operators discussed in class (SELECT, FROM, WHERE, GROUP BY, HAVING, CASE, subqueries). You cannot use LIMIT or window functions (not that they are needed). Type your answers and format your queries.

The following database schema is given:

BOOK(isbn,title,num-pages,publisher,year,genre,price)

CUSTOMER(custid,name,address,city,stake,zip,age)

SALES(isbn,custid,num-copies,day,month,year)

Attribute isbn in SALES is a foreign key to BOOK. Attribute custid is a foreign key to CUSTOMER. Note that a book may have been sold to several customers, and customers may buy several books (thats why the key for SALES is (isbn,custid)). Note that year in BOOK is the year the book was published, year in SALES refers to the date of a particular sale. genre in BOOK describes the type of narrative, like sci-, history, romance, technical.

a.). Find the number of customers from KY that have not bought any sci- books (but they bought some book).

b.) List the titles of books that have sold more copies in 2015 than in 2016.

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

Students also viewed these Databases questions

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago