0

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

1 Answer 1

2

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.