Junior — Middle
Can you name the types of keys used in database management systems?
sobes.tech AI
Answer from AI
In database management systems (DBMS), different types of keys are used for organizing and ensuring data integrity:
- Primary Key — a unique identifier for a record in a table. It cannot be NULL and must be unique.
- Foreign Key — a field or set of fields that references the primary key of another table, establishing a relationship between tables.
- Unique Key — guarantees the uniqueness of values in a column or a set of columns, but may allow NULLs (depending on the DBMS).
- Composite Key — a key consisting of multiple columns that together ensure the uniqueness of a record.
- Alternate Key — any unique key that is not the primary key.
- Surrogate Key — an artificial key, usually a numeric identifier, that does not carry business meaning.
These keys help maintain data integrity and optimize queries.