The assignment is to create tables in MySQL using the provided data, and answer 17 questions based on the given tables. The tables include J (jobs), P (parts), SPJ (supplier part job), and some additional information about suppliers, parts, and jobs.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
COSC 578 Database Management Systems Professor: Sungchul Hong HW#6 Please create following tables by using MySQL and answer the following questions. Submit a table creation script and data insert script. Then prepare the report as follows: question number, question, SQL statement and the result table for each question. J j_numjnamecity j1SorterParis j2PunchRome j3ReaderAthens j4ConsoleAthens j5CollatorLondon j6TerminalOslo j7TapeLondon P p_numpnamecolorweightcity p1NutRed12London p2BoltGreen17Paris p3ScrewBlue17Rome p4ScrewRed14London p5CamBlue12Paris p6CogRed19London S s_nums_namestatuscity s1Smith20London s2Jones10Paris s3Blake30Paris s4Clark20London s5Adams30Athens SPJ s_nump_numj_numqty s1p1j1200
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
s_nump_numj_numqty s1p1j4700 s2p3j1400 s2p3j2200 s2p3j3200 s2p3j4500 s2p3j5600 s2p3j6400 s2p3j7800 s2p5j2100 s3p3j1200 s3p4j2500 s4p6j3300 s4p6j7300 s5p1j4100 s5p2j2200 s5p2j4100 s5p3j4200 s5p4j4800 s5p5j4400 s5p5j5500 s5p5j7100 s5p6j2200 s5p6j4500 Note: Qty, status, and weight are numbers. Exercise 1. Get supplier names and numbers for all suppliers who supplied part P3 and whose name begins with letter A. 2. Get supplier names and numbers for all suppliers whose name (supplier name) begins with letter A and who supplied parts whose name (part’s name) begins with setter S. 3. Get supplier names for suppliers who supplied for job J2. (Use a sub query) 4. Get supplier names for suppliers who supplied parts for jobs only in Athens. (Use sub query) 5. Get part names for parts that are not supplied for job J3. (Use a sub query)
6. Get supplier numbers for suppliers with status lower than that of supplier S1. 7. Get supplier numbers and names for suppliers whose status is greater than status values of all suppliers in located Paris. 8. Calculateeachsupplier’s total sales quantity and get the sales person’s name if the sales person supplies parts more than 1000 units in total. 9. Get job numbers for jobs whose city is first in the alphabetical list of the job cities. 10. Increase the status values of suppliers by 5 who are located in Paris. Please hand in the modified table and the query. 11. Change the name to ‘Hammer’ of parts that are Red and located in London and whose name was Screw. Please hand in the modified table and the query. 12. Delete all jobs in Rome and all corresponding part shipments. (Please use 2 queries) Please hand in the modified table and the query. 13. Smith moved to Adam’s location. Please update Smith’s city but do not use the city name directly. 14. Please create a “view table” supplier_shipment that shows each supplier and its total shipment quantity. (if the system do not allow you to create a view table then skip this question) 15. Please try to increase Smith’s total shipment by 100 in the view table you created in question 14. Then discuss what happens when you try to update the view table. (if question 14 is successful) 16. Please create a base table supplier_shipment that shows each supplier and its total shipments from S and SPJ tables. 17. Please repeat question 15 on the base table supplier_shipment and discuss the result. Note: You might need following setting before run your update SQL SETSQL_SAFE_UPDATES=0;