Mysql – Column Terminology

MySQLterminology

I'm a MySQL student here trying to learn the proper way to call things in the SQL language.

CREATE TABLE tbl_name (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    width SMALLINT UNSIGNED,
    height SMALLINT UNSIGNED,
    content TEXT,
    date_added DATE NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

In the above SQL, "id" is the column name, INT is the data type, but what are the following keywords known as: NOT NULL, AUTO_INCREMENT, PRIMARY KEY, UNSIGNED.

Not asking what they do or how they work, just asking what they're known as in the SQL world, e.g., SMALLINT is known as a "data type."

Best Answer

id is the column name

True

INT is the data type

False. Datatype is INT UNSIGNED.

what are following known as?

NOT NULL, AUTO_INCREMENT - they are named "attributes". More precisely, they are "column attributes".

PRIMARY KEY - this is NOT a part of column definition, this is constraint (and according index) definition/specification.

All above is explained in CREATE TABLE Statement article.