Database Systems Provide working SQL DML statements for the following database s
ID: 3723450 • Letter: D
Question
Database Systems
Provide working SQL DML statements for the following database schema and queries EXERCISE CUSTOMER , Type, Firstname, Lastname, Address, City) INVENTORY(ID, ItemName, Type, MadeInStore, SupplierName, DailyAverageSold, Price) ORDERS (ID, Customer_FK, Item_FK, Quantity, DeliveryDate) 11. Find orders requesting 10 or more units of a product 12. Find what products and how many units of each product Show: order id, deliver date, item name, quantity customers ordered in each order Show: Lastname, firstname, item name, and quantity For each item in each order, find the item partial amount Show: order id, lastname, quantity, price and partial-amountt . Hint: Partia!Amount = Quantity * Price 13.Explanation / Answer
--11
SELECT o.id,o.deliverydate,i.itemname,o.quantity FROM customer c INNER JOIN orders o ON c.ID=o.customer_fk INNER JOIN inventory i ON o.item_fk=I.id WHERE o.quntity >= 10;
--12
SELECT c.firstname,c.lastname,I.itemname,sum(o.quantity ) as quqntity from customer c inner join orders o on c.id=o.customer_fk INNER join inventory i on o.item_fk=i.id group by c.lastname,c.firstname,I.itemname
--13
SELECT o.id,c.lastname,o.quantity,(o.quantity*i.price) As partialamount from customer c INNER JOIN orders o on c.id=o.customer_fk INNER JOIN inventory i on o.item_fk=I.id group by o.id
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.