Case Study: Alumni Database
Total Page:16
File Type:pdf, Size:1020Kb
THE UNIVERSITY OF TEXAS AT DALLAS SCHOOL OF MANAGEMENT MIS 6326: DATABASE MANAGEMENT SYSTEMS SPRING 2000
Solution Key for Practice SQL Problems (HW#6)
1. Display the names of all the suppliers. SELECT NAME FROM SUPPLIERS;
2. For each quotation, display the part number, the supplier number, and the price quoted by that supplier. SELECT PARTNO, SUPPNO, PRICE FROM QUOTATIONS;
3. Display the part number, price, and quantity-on-order for all quotations from supplier # 61. SELECT PARTNO, PRICE, QONORDER FROM QUOTATIONS WHERE SUPPNO=61;
4. Display the part number for all parts that have a quantity on hand of at least 1000. SELECT PARTNO FROM INVENTORY WHERE QONHAND>=1000;
5. Display part number, price quoted, delivery time, and quantity on order on all quotations from suppliers with supplier numbers 51, 53, or 57. SELECT PARTNO, PRICE, DELIVERY_TIME, QONORDER FROM QUOTATIONS WHERE SUPPNO IN (51, 53, 57);
6. Display all information on those suppliers whose names have the string 'Parts' in it. SELECT * FROM SUPPLIERS WHERE NAME LIKE '%PARTS%';
7. Display the part number, price quoted, and quantity on order for quotations from all suppliers on those parts for which supplier # 61 has quoted a price. SELECT PARTNO, PRICE, QONORDER FROM QUOTATIONS WHERE PARTNO IN ( SELECT PARTNO FROM QUOTATIONS WHERE SUPPNO=61);
8. Display the total cost for each part that has been ordered from 'Eagle Hardware'. Include the part number and delivery time associated with each part. SELECT PARTNO, DELIVERY_TIME, PRICE*QONORDER AS TOTAL_COST FROM QUOTATIONS, SUPPLIERS WHERE SUPPLIERS.SUPPNO=QUOTATIONS.SUPPNO AND SUPPLIERS.NAME='EAGLE HARDWARE';
9. Display the supplier number and part number for those parts whose total order cost is less than $50.00. SELECT SUPPNO, PARTNO FROM QUOTATIONS WHERE PRICE*QONORDER<50;
10. Display the total amount needed to pay for all the parts ordered from the supplier 'Titanic Parts'. SELECT SUM(PRICE*QONORDER) AS TOTAL_AMOUNT FROM QUOTATIONS, SUPPLIERS WHERE SUPPLIERS.SUPPNO=QUOTATIONS.SUPPNO AND SUPPLIER.NAME='TITANIC PARTS';