-
AUTO_INCREMENT
CREATE TABLE name
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
first CHAR(25), last CHAR(25) );
The AUTO_INCREMENT property automatically assigns a value to the id field, increasing the previous id number by one for each new field.
This ensures that the NOT NULL (can't be blank) and the PRIMARY KEY (can't have duplicates) properties of the id field are both satisfied.
-
CHAR
CREATE TABLE name
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
first CHAR(25), last CHAR(25) );
The CHAR datatype for the first and last fields limits the length of entries to 25 characters each.
In the us_presidents database, you've created a table called name that's organized like this:
Field |
Datatype |
Properties |
id |
INT |
primary key, not null, auto increment |
first |
CHAR(25) |
|
last |
CHAR(25) |
|