In MySQL keys and constraints are used to assign a special index to a column, meaning that this column will be approached somehow different by the MySQL server; or in other terms it will be facilitated.
Here are the lists of MySQL indexes and constraints:
INDEX | DESCRIPTION |
---|---|
UNIQUES | Assigned column's value has to be unique inside the database, or will be rejected |
FULLTEXT | Accepts only values that are of CHAR, VARCHAR or TEXT type. May be used only with MyISAM engine |
SPATIAL | Accepts only spatial columns. Used only with MyISAM engine and accepts no NULL values |
NAME | DESCRIPTION |
---|---|
AUTO_INCREMENT | Sets which column will have automatic increment with every new input. Usually same as PRIMARY KEY |
CHARACTER SET | Sets database's or table's character set in MySQL |
CHECK | Specifies condition when manipulating data inside s table |
COLLATION | Sets database's or table's collation |
CONSTRAINT | Sets or resets (drops) a constraint index applied to multiple columns. |
ON DELETE CASCADE | Deletes data from child tables |
DEFAULT | Inserts a default value into a column |
FOREIGN KEY | Used to link two tables by pointing its own table to the primary key of another one |
IDENTITY | Used in combination with AUTO_INCREMENT to define the starting number and step of increment |
NOT NULL | Makes sure that NULL values are nor allowed while inerting or updating rows of a particular column; NULL values refers to no value at all and it does not include empty spaces |
PRIMARY KEY | Uniquely identifies each record in a database table with the difference that one table may have only one PRIMARY KEY |
REFERENCES | Used with FOREIGN KEY specifying that the values of the referencing table (FOREIGN_KEY) are present in the referenced table too |
UNIQUE | Uniquely identifies each record in a database table |
Comments
No comments have been made yet.
Please login to leave a comment. Login now