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

Database Systems Provide working SQL DML statements for the following database s

ID: 3723448 • 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(TD, ItemName, Type, MadeInStore, SupplierName, DailyAverageSold, Price) ORDERS(ID, customer-FI, Item-FK, Quantity, DeliveryDate) 3. Find the number of customers 4. Find the number of items in the inventory 5. For each item, find how many units of such item have been ordered Find the average number of items each customer has ordered 6.

Explanation / Answer

3) SELECT COUNT(ID) FROM CUSTOMERS;

4) SELECT COUNT(ID) FROM INVENTORY;

5) SELCT INVENTORY.ID, SUM(SELECT QUNATITY FROM ORDERS,INVENTORY WHERE ITEM_FK=INVENTORY.ID);

6) SELECT AVG(SELCT QUANTITY FROM CUSTOMER,ORDERS WHERE CUSTOMER_FK=CUSTOMER.ID);