From the course: Advanced MySQL Database Administration
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Challenge: Primary key to foreign key mapping - MySQL Tutorial
From the course: Advanced MySQL Database Administration
Challenge: Primary key to foreign key mapping
- [Instructor] All right, we're ready for your next assignment, which is on primary and foreign key mapping. Again, Sally's coming to you with additional data requirements that are resulting from the launch of the new product. So in previous assignments, you've added the products table. You've updated the order items table to include a product ID, and she would like to make sure that the proper primary and foreign key relationships exist between those tables. This is important because going forward it will help ensure the data integrity of those tables. For example, let's say in the future you had four products, product ID one through four. If someone tries to enter a value of five or six into the order items table, which is an invalid ID, because of that foreign key to primary key relationship, it's going to prevent that from happening and you'll preserve the integrity of your data. So the only tip I'll give you here is you can do this using code or you can do it using the UI…
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)
Overview of alter, update, and key relationships1m 29s
-
(Locked)
Review: Altering tables5m 24s
-
Review: Updating records7m 55s
-
(Locked)
Review: Table relationships and cardinality4m 55s
-
(Locked)
Challenge: Introducing a new product1m 8s
-
(Locked)
Solution: Introducing a new product4m 18s
-
(Locked)
Challenge: Adding a product to order items55s
-
(Locked)
Solution: Adding a product to order items1m 45s
-
(Locked)
Challenge: Updating product data in order items1m 19s
-
(Locked)
Solution: Updating product data in order items2m 20s
-
(Locked)
Challenge: Primary key to foreign key mapping1m 17s
-
(Locked)
Solution: Primary key to foreign key mapping4m 17s
-
(Locked)
Challenge: Import 2013 Q1 data37s
-
(Locked)
Solution: Import 2013 Q1 data3m 28s
-
(Locked)
-
-
-
-
-
-
-
-
-