1. What does "data integrity" mean in the context of a database?
A. The process of backing up data
B. The accuracy and consistency of data
C. The process of archiving data
D. The ability to retrieve data quickly
Answer: B) The accuracy and consistency of data
Rationale: Data integrity ensures that the data in the database remains accurate,
consistent, and reliable throughout its lifecycle.
2. What is a "recursive query" in SQL?
A. A query that uses the GROUP BY clause to aggregate data
B. A query that calls itself to retrieve data from hierarchical structures
C. A query that deletes data from multiple tables
D. A query that modifies the structure of a table
Answer: B) A query that calls itself to retrieve data from hierarchical structures
,Rationale: Recursive queries are used to retrieve hierarchical data, like
organizational charts or folder structures, where data refers to itself.
3. What is the purpose of a foreign key constraint in a relational database?
A. To uniquely identify each record in a table
B. To ensure that data in one table corresponds to data in another table
C. To restrict updates to a table
D. To improve query performance
Answer: B) To ensure that data in one table corresponds to data in another table
Rationale: A foreign key constraint ensures that a field in one table matches a valid
record in another table, maintaining referential integrity.
4. Which of the following best describes a relational database?
A. A database where data is stored in flat files
B. A database that uses tables to store data and relationships between data
C. A database that does not support queries
D. A database that stores unstructured data
Answer: B) A database that uses tables to store data and relationships between data
, Rationale: A relational database uses tables (relations) to organize data and
supports relationships between those tables.
5. What is the difference between a JOIN and a UNION in SQL?
A. JOIN combines rows from two tables based on a related column; UNION
combines the result sets of two queries
B. JOIN combines columns from two tables; UNION combines rows from two
queries
C. JOIN creates a new table; UNION deletes duplicate rows
D. JOIN can only be used on primary keys; UNION can only be used on foreign
keys
Answer: A) JOIN combines rows from two tables based on a related column;
UNION combines the result sets of two queries
Rationale: A JOIN is used to combine rows from two or more tables based on a
related column, while UNION combines results from multiple queries into a single
result set.
6. Which of the following is an example of a data definition language (DDL)
command?
A. The process of backing up data
B. The accuracy and consistency of data
C. The process of archiving data
D. The ability to retrieve data quickly
Answer: B) The accuracy and consistency of data
Rationale: Data integrity ensures that the data in the database remains accurate,
consistent, and reliable throughout its lifecycle.
2. What is a "recursive query" in SQL?
A. A query that uses the GROUP BY clause to aggregate data
B. A query that calls itself to retrieve data from hierarchical structures
C. A query that deletes data from multiple tables
D. A query that modifies the structure of a table
Answer: B) A query that calls itself to retrieve data from hierarchical structures
,Rationale: Recursive queries are used to retrieve hierarchical data, like
organizational charts or folder structures, where data refers to itself.
3. What is the purpose of a foreign key constraint in a relational database?
A. To uniquely identify each record in a table
B. To ensure that data in one table corresponds to data in another table
C. To restrict updates to a table
D. To improve query performance
Answer: B) To ensure that data in one table corresponds to data in another table
Rationale: A foreign key constraint ensures that a field in one table matches a valid
record in another table, maintaining referential integrity.
4. Which of the following best describes a relational database?
A. A database where data is stored in flat files
B. A database that uses tables to store data and relationships between data
C. A database that does not support queries
D. A database that stores unstructured data
Answer: B) A database that uses tables to store data and relationships between data
, Rationale: A relational database uses tables (relations) to organize data and
supports relationships between those tables.
5. What is the difference between a JOIN and a UNION in SQL?
A. JOIN combines rows from two tables based on a related column; UNION
combines the result sets of two queries
B. JOIN combines columns from two tables; UNION combines rows from two
queries
C. JOIN creates a new table; UNION deletes duplicate rows
D. JOIN can only be used on primary keys; UNION can only be used on foreign
keys
Answer: A) JOIN combines rows from two tables based on a related column;
UNION combines the result sets of two queries
Rationale: A JOIN is used to combine rows from two or more tables based on a
related column, while UNION combines results from multiple queries into a single
result set.
6. Which of the following is an example of a data definition language (DDL)
command?