…In a relational data base, it's common to have…one table refer to another table by its primary key.…Problems can arise however if the reference…points to a key that doesn't exist.…The foreign key constraint is designed to prevent this from happening.…We'll be using the scratch database for this lesson…and again I'm going to copy from the exercise files.…Because well, in this case it actually happens…to be a very significant amount of typing.…
And the reason for this is that in order to demonstrate the foreign key…constraint, we really need to have several…tables with different purposes and have them.…Interconnected with a few rows of data.…And so we have three tables here, a client table, a book table, and a lend table.…So the client table just really has a name for the client and an ID.…You notice it's integer, AUTO_INCREMENT PRIMARY KEY.…And a book table for the books that are going to be lent to…the clients, with the title of the book and an ID, very simple tables.…
And a lend table and this is what's…called a junction table in relational database terminology.…
- Writing queries
- Creating and updating databases and tables
- Using MySQL built-in functions
- Sorting and filtering data
- Updating tables with triggers
- Working with subselects and views
- Creating and using a stored function
Skill Level Beginner
1. Installing and Configuring the Test Environment
2. Basic Syntax
3. Creating a Database
4. MySQL Data Types
5. MySQL Functions
8. Subselects and Views
9. Stored Routines
10. PHP's PDO Interface with MySQL
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.