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


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

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

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!