Controlling column behavior with constraints


show more Controlling column behavior with constraints provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training show less
please wait ...

Controlling column behavior with constraints

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 o...

Controlling column behavior with constraints
Video duration: 4m 46s 4h 24m Beginner

Viewers:

Controlling column behavior with constraints provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training

Subject:
Developer
Software:
MySQL
Author:
please wait ...