Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ORACLE SQL DATABASE BASED ON THE ER MODEL GIVEN BELOW, FIND OR COMPUTE THE FOLLO

ID: 3790477 • Letter: O

Question

ORACLE SQL DATABASE
BASED ON THE ER MODEL GIVEN BELOW, FIND OR COMPUTE THE FOLLOWING SQL QUERIES:

a. List the total sales as measured in dollars for each Company. Include the mid, name of the Company and total value of sales, sort the output by total value of sales b. Find the total amount of wheat flour that was used in the Products that were bought by Customers. c. List the deliveries for which the quantity delivered exceeded the amount of purchases by the customer who lives at the delivery address. Include both the quantity delivered and the quantity purchased. d. Find the total number of loaves of bread that were bought by Customers, and the total value of them. e. List the addresses for which there are no customers and no companies

Explanation / Answer

1. select a.name ,b.sum(b.prize) from company a,product b where a.name=b.name

group by a.name order by b.prize

2. select c.name,sum(b.prize) from customer c, product b where c.name=b.name and b.name=' wheat flour '

group by a.name

4. select c.name,sum(b.prize) from customer c, product b where c.name=b.name and b.name=' Bread '

group by a.name

5. select c.name,a.name,d.address from customer c,company a, address d where c.name=a.name

and c.name is NULL and a.name is NULL