Question: 2. Based on the tables we used in SQL Exercise Part 4 (i.e., Cyclists, Locations, Weather), write SQL queries to answer the following questions [

2. Based on the tables we used in SQL Exercise Part 4 (i.e., Cyclists, Locations, Weather), write SQL queries to answer the following questions [ 5 points each; 15 points in total]. 5) Find a primary key in each table. Compose SQL queries to define the primary keys (no need to show query result for this question, just paste your query statements here). Note that you should already established the primary key for the Locations table if you have finished the SQL Exercise Part 4. 6) Establish a foreign key constraint between Weather and Locations table (no need to show query result for this question, just paste your query statements here). Note that this should be a constraint on the Locations table, meaning that all dates you have in your Locations table must exist in the Weather table. 7) Try to insert the following row into the Locations table. What happens when you insert this row? Why? INSERT INTO Locations(LocationID, Road, Direction, Date) VALUES (50, 'Stevens Way \& Benton Ln', 'NB', '2017-02-08')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
