Lab week 10 SQL Solution

Lab week 10 SQL
Using the class example database (SQLFUN), create the required SQL statements to produce the following results:
Use a cross join to create a table having all combinations of
• Ice cream: chocolate, vanilla, coffee, strawberry.
• Sauce: hot fudge, butterscotch, chocolate.
• Nuts: peanuts, pecans, almonds, no nuts.
• Cherry: cherry, no cherry.
First you need to create a table for each of these lists of options (Hint: You will get 96 rows).

For the Week 10 Lab, you will need to create a table for each of the food items (ice cream, sauce, etc.). Each table will have the list of choices for each food item (e.g., chocolate, etc. for the ice_cream table). You can look at Chapter 6 to review commands to create a table and to insert data into a table.
Then you will need to write a query to perform a cross join of all the tables you just created. This cross join operation should result in 96 rows and list all combinations of the food item choices listed in the assignment. Here is a partial list of the results:
ice_cream sauce nuts cherry
chocolate hot fudge peanuts cherry
chocolate hot fudge peanuts no cherry
chocolate butterscotch peanuts cherry
Please include the following in the document you submit:
• SQL statements to create the tables for the food items
• SQL statements to insert data into the tables
• Contents of each table.
• SQL statement to perform cross join of these tables.
• Results of cross join (should be 96 rows)
As with previous labs, please note that if you’re using Access, you can use the GUI to create the tables and insert data into them, but you still need to provide the corresponding SQL statements.


Powered by