Primary Key Definition
Which of the following best describes the role of a primary key in a relational database table?
- It ensures that all columns have the correct data type.
- It uniquely identifies each row in the table.
- It defines the relationship between two tables.
- It is used to store the names of the columns in a table.
- It determines the order in which the rows are displayed.
Foreign Key Purpose
What is the purpose of a foreign key in a relational database?
- To uniquely identify each record in a table.
- To define a relationship between two tables by referencing the primary key of another table.
- To store calculated values.
- To filter data based on a specific condition.
- To ensure that no column contains null values.
Normalization Goal
What is the primary goal of normalizing a relational database?
- To speed up data retrieval.
- To reduce data redundancy and improve data integrity.
- To increase the number of tables in the database.
- To complicate data relationships.
- To make the database more difficult to manage.
One-to-Many Relationships
In a relational database, how is a one-to-many relationship typically implemented?
- By including all the data from both tables in a single table.
- By creating a junction table.
- By storing multiple values in a single cell.
- By including the primary key of the 'one' side in the 'many' side table as a foreign key.
- By storing the primary key of the 'many' side in the 'one' side table.
SELECT Statement
Which SQL statement is used to retrieve data from a relational database?
- UPDATE
- INSERT
- DELETE
- SELECT
- CREATE TABLE
Filtering data
In SQL, which clause is used to filter the rows returned by a SELECT statement?
- SORT BY
- GROUP BY
- WHERE
- HAVING
- ORDER BY
Junction Tables
What is the purpose of a junction table in relational database design?
- To store temporary data.
- To resolve many-to-many relationships between two tables.
- To speed up data retrieval.
- To store only the primary key of a table.
- To enforce data validation rules.
First Normal Form
What is the main characteristic of a table in First Normal Form (1NF)?
- It must have a primary key.
- All non-key attributes must be fully dependent on the primary key.
- It contains no repeating groups of columns and each cell contains only one value.
- It has no transitive dependencies.
- It does not contain any foreign keys.
Entity Integrity Rule
According to the entity integrity rule, what is the restriction on a primary key column?
- It must be an integer.
- It must contain only unique values.
- It cannot contain NULL values.
- It must be a foreign key in another table.
- It must be indexed.
Composite Key Definition
What is a composite key in a relational table?
- A key that is automatically generated.
- A key that is made up of two or more columns.
- A key that is used to encrypt data.
- A key that is used to access data remotely.
- A key that is used for indexing only.