Junior — Middle
Can you list the main limitations that exist for tables in databases?
sobes.tech AI
Answer from AI
Constraints for tables in databases ensure data integrity and correctness. They include:
- PRIMARY KEY — a unique identifier for each record, does not allow NULL.
- FOREIGN KEY — maintains referential integrity between tables, linking records to another table.
- UNIQUE — guarantees the uniqueness of values in a column or set of columns.
- NOT NULL — prohibits NULL values in the specified column.
- CHECK — sets a condition that values in the column must satisfy.
For example, in a users table, you can specify that the email must be unique and not empty, and the age must be a positive number.