Database Management System (DBMS) MCQs

Computer

Database Management System (DBMS) MCQs

Practice DBMS MCQs covering database, data, information, DBMS, RDBMS and SQL basics with answers and explanations.

278
Total Questions

Practice Questions

Page 6 of 14
Question #101
Which of the following is a valid way to join three tables in SQL?
A. SELECT * FROM table1, table2, table3 WHERE condition1 AND condition2;
B. SELECT * FROM table1 JOIN table2 ON condition1 JOIN table3 ON condition2;
C. Both A and B
D. Neither

Correct Answer: Option C


Explanation:
Both syntaxes are valid: explicit JOIN syntax and implicit comma join with WHERE conditions.

This question belongs to: Computer Database Management System (DBMS)
Question #102
What is the purpose of the SQL COALESCE function?
A. Computes the sum
B. Concatenates strings
C. Converts data types
D. Returns the first non-NULL value from a list

Correct Answer: Option D


Explanation:
COALESCE returns the first non-NULL value among its arguments, often used to provide a default value.

This question belongs to: Computer Database Management System (DBMS)
Question #103
Which normal form enforces that no non-prime attribute depends on a subset of a candidate key?
A. 2NF
B. 3NF
C. BCNF
D. 1NF

Correct Answer: Option A


Explanation:
2NF eliminates partial dependencies, i.e., non-prime attributes dependent on part of any candidate key.

This question belongs to: Computer Database Management System (DBMS)
Question #104
What is a database transaction?
A. A query that reads data
B. A backup copy of the database
C. A database schema
D. A logical unit of work that consists of one or more SQL statements

Correct Answer: Option D


Explanation:
A transaction is a sequence of operations performed as a single logical unit, ensuring ACID properties.

This question belongs to: Computer Database Management System (DBMS)
Question #105
Which of the following is true about a surrogate key?
A. It is an artificial key, usually an auto-increment integer, with no business meaning
B. It is a natural key derived from the data
C. It is a foreign key
D. It is a composite key

Correct Answer: Option A


Explanation:
A surrogate key is a system-generated unique identifier, typically numeric, that has no business significance.

This question belongs to: Computer Database Management System (DBMS)
Question #106
What is the purpose of the SQL GROUP BY ... HAVING combination?
A. To join groups
B. To filter groups based on aggregate values
C. To sort groups
D. To select individual rows

Correct Answer: Option B


Explanation:
HAVING is used in conjunction with GROUP BY to filter groups based on conditions applied to aggregate functions.

This question belongs to: Computer Database Management System (DBMS)
Question #107
Which of the following is not an aggregate function in SQL?
A. DESC
B. SUM
C. MAX
D. AVG

Correct Answer: Option A


Explanation:
DESC is a keyword for sorting order, not an aggregate function.

This question belongs to: Computer Database Management System (DBMS)
Question #108
What is a foreign key constraint violation?
A. Updating a primary key that is referenced
B. All of the above
C. Inserting a value in a foreign key column that does not exist in the referenced primary key
D. Deleting a primary key that is referenced by a foreign key

Correct Answer: Option B


Explanation:
Any action that breaks referential integrity, such as inserting an orphan record, deleting a referenced record, or updating a referenced key, will violate the foreign key constraint.

This question belongs to: Computer Database Management System (DBMS)
Question #109
Which SQL statement is used to delete all rows from a table without logging individual row deletions?
A. REMOVE FROM table_name;
B. DELETE FROM table_name;
C. DROP TABLE table_name;
D. TRUNCATE TABLE table_name;

Correct Answer: Option D


Explanation:
TRUNCATE TABLE removes all rows and is a DDL operation with minimal logging, often faster than DELETE without WHERE.

This question belongs to: Computer Database Management System (DBMS)
Question #110
What is a database schema?
A. The overall design or structure of the database, including tables, columns, and relationships
B. A query result
C. A backup file
D. A single table

Correct Answer: Option A


Explanation:
A schema is the logical description of the entire database, defining tables, views, indexes, and constraints.

This question belongs to: Computer Database Management System (DBMS)
Question #111
What is the difference between a database and a data warehouse?
A. Databases are for OLTP, data warehouses for OLAP
B. They are the same
C. Both A and B
D. Databases store current data; data warehouses store historical data

Correct Answer: Option C


Explanation:
Databases are optimized for transaction processing (OLTP), while data warehouses are designed for analytical reporting (OLAP) using historical data.

This question belongs to: Computer Database Management System (DBMS)
Question #112
Which of the following is a valid SQL data type for a date and time?
A. DATETIME
B. TIMESTAMP
C. All of the above
D. DATE

Correct Answer: Option C


Explanation:
Different DBMS support DATETIME, TIMESTAMP, DATE, etc. All are valid date/time types.

This question belongs to: Computer Database Management System (DBMS)
Question #113
What is the purpose of the SQL 'UNION' operator?
A. To filter duplicates
B. To combine the results of two or more SELECT statements, removing duplicates
C. To aggregate data
D. To join tables horizontally

Correct Answer: Option B


Explanation:
UNION concatenates the result sets of two or more queries, eliminating duplicate rows. UNION ALL keeps duplicates.

This question belongs to: Computer Database Management System (DBMS)
Question #114
Which SQL operator is used to check if a value is within a range?
A. LIKE
B. BETWEEN
C. EXISTS
D. IN

Correct Answer: Option B


Explanation:
BETWEEN checks if a value falls within a specified range (inclusive of boundaries).

This question belongs to: Computer Database Management System (DBMS)
Question #115
What is a domain in the context of the relational model?
A. A set of allowed values for an attribute
B. A foreign key
C. A table name
D. A primary key

Correct Answer: Option A


Explanation:
A domain defines the set of permissible values that an attribute can take, ensuring data consistency.

This question belongs to: Computer Database Management System (DBMS)
Question #116
Which of the following is a property of a database that ensures transactions are isolated from each other?
A. Isolation
B. Atomicity
C. Consistency
D. Durability

Correct Answer: Option A


Explanation:
Isolation ensures that concurrent execution of transactions results in a state that is equivalent to some serial execution.

This question belongs to: Computer Database Management System (DBMS)
Question #117
What is a candidate key in a relation?
A. A foreign key
B. A super key that is minimal
C. Any column that can be used as a primary key
D. A key that is not unique

Correct Answer: Option B


Explanation:
A candidate key is a minimal super key, meaning no subset of it can uniquely identify a row.

This question belongs to: Computer Database Management System (DBMS)
Question #118
Which of the following is an example of a NoSQL database?
A. MySQL
B. Oracle
C. PostgreSQL
D. MongoDB

Correct Answer: Option D


Explanation:
MongoDB is a document-oriented NoSQL database. PostgreSQL, MySQL, and Oracle are RDBMS.

This question belongs to: Computer Database Management System (DBMS)
Question #119
What is the purpose of the SQL 'CASE' statement?
A. To implement conditional logic within a query
B. To update records
C. To create a table
D. To delete records

Correct Answer: Option A


Explanation:
CASE allows for conditional expressions, similar to IF-THEN-ELSE, within SQL statements.

This question belongs to: Computer Database Management System (DBMS)
Question #120
In SQL, what does the 'IS NULL' operator check?
A. Whether a value is missing (null)
B. Whether a value equals NULL
C. Whether a value is empty string
D. Whether a value is zero

Correct Answer: Option A


Explanation:
IS NULL is used to test for NULL values, because NULL is not equal to anything.

This question belongs to: Computer Database Management System (DBMS)