Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the SQL statement that extracts the name and author of books that were published in 2020. Order the result by the name of


 image

Write the SQL statement that extracts the name and author of books that were published in 2020. Order the result by the name of the book in ascending order. Write the SQL statement that extracts information about the customers and the books they ordered. The result should contain the id and name of customers and the name and author of the book. Write the SQL statement that extracts the id and name of books that were ordered in year 2021. The result should contain no duplicates. Write the SQL statement that extracts the id and name of books that do not have an author. Question 1) (70 points) Given the following db schema: Books (bid:integer, bname:string, author:string, pubyear:integer, price:integer) Customers (cid:integer, cname:string, city:string) Orders (cid:integer, bid:integer, orderdate:date) Primary keys are underlined in each relation. Relation Books contains information about books. A book is uniquely identified by bid. A book also has a name (attr. bname), an author, a publication year (attr. pubyear) and a price. Relation Customers contains information about customers. A customer is uniquely identified by cid. A customer also has a name (attr. cname), and a city. Customers order Books. When a customer orders a book, a record is inserted into relation Orders, having the cid of that customer, the bid of that book, and the order date (attr. orderdate). Each record in Orders relation is uniquely identified by cid,bid. Notes: For both CS430 and CS630 students, each problem (a through j) carries 7 points possible. Please test your SQL statements from the file you submit! SQL statements that do not run successfully against the Oracle DB will receive 0 credit. Using this db schema: a) Write the SQL statements to create table Books from this db schema. Do not forget to define the necessary key constraints. b) Write the SQL statements to create table Customers from this db schema. Do not forget to define the necessary key constraints. c) Write the SQL statements to create table Orders from this db schema. Do not forget to define the necessary key constraints. d) Write the SQL statement to extract how many books are in the DB. e) Write the SQL statement to extract how many customers from 'Boston' are in the DB. f) Write the SQL statement to extract how many customers from each city are in the DB. 2

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

Using Excel & Access for Accounting 2010

Authors: Glenn Owen

3rd edition

1111532672, 978-1111532673

More Books

Students also viewed these Databases questions

Question

How is grouping used with the cash budget?

Answered: 1 week ago

Question

16. What is the difference between a lesion and an ablationpg109

Answered: 1 week ago