Join Bill Weinman for an in-depth discussion in this video Controlling column behavior with constraints, part of MySQL Essential Training (2014).
…As you're defining your table you may want to…define specific rules and behaviors for some of your columns.…This is done by using constraints.…I'm going to use the Scratch database for this lesson.…And I'm going to copy and paste some code here…out of the Chapter 3 exercise file, here around line 73.…Everything from drop table to select from test.…Press Cmd+C to copy, and Cmd+V to paste.…That's Ctrl+C and Ctrl+V, if you're using a PC.…
And you see, we start here with a drop table.…Because, again, we're going to be creating this…table over and over again with different options.…So we need a drop table at the start of that.…And, then we have the create table, which is two columns, an integer, and a varchar.…And, we'll insert a row into it, describe it and select from it.…And so that looks like this.…There's our table and there's our one row.…In this example you'll notice that the A column has…a null value because no data was added to that column.…
If you look here at our insert.…We're only inserting data into row B.…
- 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.