From the course: Database Foundations: Data Structures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Link tables with keys

Challenge: Link tables with keys

From the course: Database Foundations: Data Structures

Start my 1-month free trial

Challenge: Link tables with keys

(bouncy techy music) - [Narrator] We've covered a lot of information about relating tables together with primary and foreign keys. So it's time to test your knowledge with another challenge. In the previous challenges, you created a table for employees and then added a primary key column to the employees table. Now I'd like you to create another table to hold related information about quarterly bonuses that each employee earned. the new table should store information about the quarter the bonus was earned and the amount paid to each employee. Next, create a foreign key constraint to ensure that every row in the new bonus table relates to exactly one employee. Finally, test out the foreign key constraint by inserting a row for an existing employee and then try and add a row linked to an employee ID that doesn't exist. This challenge should take 10 minutes or less to complete and as always, I'll share my solution in the…

Contents