Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following schema: I would like to know the SQL queries to: 1. Total up the number of checkouts made on each month of

Given the following schema:

image text in transcribed

I would like to know the SQL queries to:

1. Total up the number of checkouts made on each month of the year. Then print the month (spelled out completely) and the total number of corresponding checkouts next to it. That is, print "January" and total number of checkouts made in January, and so on. 2. Show the furniture styles that are checked-out on Sundays only. That is, none of the furniture in that style must have been checked out on any other days. 3. Find names of people who have checked out any piece of furniture within the last 15 days (not counting the day the query is being run) but have not returned that yet. Print their names and the string "* To be contacted" next to each name. 4. For all the furniture that were checked out in October 2018 and returned in November 2018, print their F_ID, category and style. However, while printing style, print 'M' for 'modern', 'R' for 'rustic', and 'T' for 'traditional'. 5. Assume that the price attribute of Furniture table indicates weekly (7 days) rental cost. Write a view to calculate the total money earned from all "rustic" style furniture, which has been rented and returned (i.e., do not take into consideration the ones that are yet to be returned). Print the amount.

Furniture f id category style price int char(20) char(15) dec(5,2) primary key not null values restricted to 'modern', 'rustic', traditional' not null [Example: sofa, bed,...] Per week rental cost] Customers c id name phone email int char(10) char(13) char(15) primary key not null Checkout c id f id ck out_date date ret date foreign key, references c id of customers foreign key, references f id of furniture not null int int date [c id and f id together form the primary key]

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

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago