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
From the course: Database Foundations: Data Structures
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
One-to-many relationships2m 13s
-
(Locked)
One-to-one relationships1m 27s
-
(Locked)
Many-to-many relationships2m 14s
-
(Locked)
Self-referencing relationships1m 56s
-
(Locked)
Cascade updates and deletes4m 35s
-
(Locked)
Challenge: Link tables with keys1m 8s
-
(Locked)
Solution: Link tables with keys6m 23s
-
(Locked)
-
-
-