Entities, Attributes, Data Type Flashcards
What is a Primary Key (PK) in a database?
A Primary Key (PK) is a unique identifier for a record in a table, ensuring each record is distinct and can be retrieved efficiently. It cannot have null values and there can only be one primary key per table.
What is a Foreign Key (FK)?
A Foreign Key (FK) is an attribute in a table that links to the primary key of another table, used to establish a relationship between the two tables and maintain data integrity.
Define a Composite Key.
A Composite Key is a key that consists of two or more attributes combined to uniquely identify a record in a table, used when a single attribute is insufficient for uniqueness.
What is a Surrogate Key?
A Surrogate Key is a single column with artificial values used as a primary key when a natural primary key is not available (e.g., customer_id).
What is a Candidate Key?
A Candidate Key is a minimal Super Key, a key that can uniquely identify any row in the table and does not contain a subset of attributes that is also a Super Key.
Explain the concept of a Super Key.
A Super Key is a set of attributes that can uniquely identify a row in a table, functionally determining every attribute in the row.
What is an Alternate Key?
An Alternate Key is a key that has all the properties of a Candidate Key and can be a single attribute or multiple attributes. It must be unique and can be NULL.
What are attributes in a database?
Attributes are properties or characteristics of an entity, represented by columns in a table, and each attribute represents a specific piece of data.
What are data types in databases?
Data types classify data items and specify the kind of data that can be stored and manipulated, such as integers, strings, boolean, date/time, etc.
What is a One-to-Many relationship in databases?
In a One-to-Many relationship, a single record in the primary key table can relate to none, one, or many records in the related table.
What is a Many-to-Many relationship in databases?
A Many-to-Many relationship occurs when each record in both tables can relate to none or many records in the other table, requiring an intersection table to accommodate the relationship.
What is an Intersection table?
An Intersection table is used to break a Many-to-Many relationship into two One-to-Many relationships, ensuring relational systems can accommodate the data structure.