CGS2541 Instructor: Meg McManus Homework Assignment 8 Chapter 8 1. (4 points) When is an outer join used instead of a natural join? 2. (4 points) Explain the processing order of a correlated subquery. 3. (5 points) Under what conditions can a UNION clause be used? 4. (12 points, 3 points ea) List four advantages of SQL-invoked routines. 5. (15 points, 5 points ea) The following are based on the class schedule ERD depicted in Figure 4-6 in Chapter 4 and the 3NF relations along with some sample data are repeated in Figure 8-8. For each, draw the expected Results. (Hint: The easiest method would be to create the Results tables in Excel and copy them into Word.) Write SQL retrieval commands for each of the following queries: a. Display the course ID and course name for all courses with an ISM prefix. b. Display all courses for which Professor Berndt has been qualified. c. Display the class roster, including student name, for all students enrolled in section 2714 of ISM 4212. 6. (25 points, 5 points ea) Write an SQL query to answer the following questions: 533583058 Rev. 3/9/16 Page 1 CGS2541 a. b. c. d. e. 7. Instructor: Meg McManus Which instructors are qualified to teach ISM 3113? Is any instructor qualified to teach ISM 3113 and not qualified to teach ISM 4930? How many students are enrolled in section 2714 during semester I-2004? How many students are enrolled in ISM 3113 during semester I2004? Which students were not enrolled in any courses during semester I-2004? (35 points, 5 points ea) The following are based on the entire Pine Valley Furniture database. You can use Microsoft Access or Oracle 9i for your answers. Write an SQL command to: a. display the order number, customer number, order date, and items ordered for Order #1001. b. display each item ordered for Order #1001, its standard price, and the total price for each item ordered. c. total the cost of Order #1001. (You need the answer to b for this one.) d. find any customers who have not placed orders. e. produce a list of all the products and the number of times each product has been ordered. f. display customer number, name, and order number for all customers and their orders. g. list the order number and order quantity for all customer orders for which the order quantity is greater than the average order quantity of that product. (Hint: This involves a correlates subquery.) 533583058 Rev. 3/9/16 Page 2