1. What is a primary key?
A. A field that uniquely identifies a record in a table
B. A field that can be duplicated in multiple records
C. A foreign key that references another table
D. A key that is not indexed
Answer: A) A field that uniquely identifies a record in a table
Rationale: A primary key uniquely identifies each record in a database table, ensuring no
duplicates.
2. What is a database trigger?
A. A command to execute an SQL query
B. A stored procedure that automatically executes when an event occurs
C. A query to back up data
D. A function to normalize data
Answer: B) A stored procedure that automatically executes when an event occurs
Rationale: A trigger is a stored procedure that automatically executes in response to a specific
event, like insert, update, or delete.
3. What is the advantage of using a DBMS?
,A. Improved data security
B. Reduced data redundancy
C. Easier data management
D. All of the above
Answer: D) All of the above
Rationale: A DBMS provides advantages such as data security, reduced redundancy, and
improved management of data.
4. Which of the following is an example of a non-relational DBMS?
A. PostgreSQL
B. SQLite
C. MongoDB
D. Oracle
Answer: C) MongoDB
Rationale: MongoDB is a non-relational (NoSQL) DBMS, which stores data in a flexible,
document-based format.
5. Which SQL statement is used to return the number of rows in a table?
A. SELECT COUNT()
B. SELECT SUM()
C. SELECT MAX()
, D. SELECT MIN()
Answer: A) SELECT COUNT()
Rationale: The COUNT() function is used to return the number of rows in a table.
6. What is the function of the HAVING clause in SQL?
A. To filter records before grouping
B. To sort the result set
C. To filter records after grouping
D. To join multiple tables
Answer: C) To filter records after grouping
Rationale: The HAVING clause is used to filter records after the GROUP BY operation has been
performed.
7. Which SQL clause is used to specify the order of records in the result set?
A. ORDER BY
B. SORT BY
C. GROUP BY
D. FILTER BY
Answer: A) ORDER BY
Rationale: The ORDER BY clause is used to sort the records in ascending or descending order.
A. A field that uniquely identifies a record in a table
B. A field that can be duplicated in multiple records
C. A foreign key that references another table
D. A key that is not indexed
Answer: A) A field that uniquely identifies a record in a table
Rationale: A primary key uniquely identifies each record in a database table, ensuring no
duplicates.
2. What is a database trigger?
A. A command to execute an SQL query
B. A stored procedure that automatically executes when an event occurs
C. A query to back up data
D. A function to normalize data
Answer: B) A stored procedure that automatically executes when an event occurs
Rationale: A trigger is a stored procedure that automatically executes in response to a specific
event, like insert, update, or delete.
3. What is the advantage of using a DBMS?
,A. Improved data security
B. Reduced data redundancy
C. Easier data management
D. All of the above
Answer: D) All of the above
Rationale: A DBMS provides advantages such as data security, reduced redundancy, and
improved management of data.
4. Which of the following is an example of a non-relational DBMS?
A. PostgreSQL
B. SQLite
C. MongoDB
D. Oracle
Answer: C) MongoDB
Rationale: MongoDB is a non-relational (NoSQL) DBMS, which stores data in a flexible,
document-based format.
5. Which SQL statement is used to return the number of rows in a table?
A. SELECT COUNT()
B. SELECT SUM()
C. SELECT MAX()
, D. SELECT MIN()
Answer: A) SELECT COUNT()
Rationale: The COUNT() function is used to return the number of rows in a table.
6. What is the function of the HAVING clause in SQL?
A. To filter records before grouping
B. To sort the result set
C. To filter records after grouping
D. To join multiple tables
Answer: C) To filter records after grouping
Rationale: The HAVING clause is used to filter records after the GROUP BY operation has been
performed.
7. Which SQL clause is used to specify the order of records in the result set?
A. ORDER BY
B. SORT BY
C. GROUP BY
D. FILTER BY
Answer: A) ORDER BY
Rationale: The ORDER BY clause is used to sort the records in ascending or descending order.