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 12 of 14
Question #221
Which clause must be used instead of WHERE to filter or restrict rows after an aggregation or group-by operation has been performed?
A. WHEN
B. WHERE CURRENT OF
C. HAVING
D. RESTRICT

Correct Answer: Option C


Explanation:
The HAVING clause was added to SQL because the WHERE keyword cannot be applied to aggregate functions; it filters groups generated by the GROUP BY clause.

This question belongs to: Computer Database Management System (DBMS)
Question #222
Which clause is used in SQL to sort the final query result set in ascending or descending order?
A. SORT BY
B. ORDER BY
C. ARRANGE BY
D. GROUP BY

Correct Answer: Option B


Explanation:
The ORDER BY clause is used to sort the result set of a query in either ascending (default) or descending (using DESC) order.

This question belongs to: Computer Database Management System (DBMS)
Question #223
What is the default sorting order when using the ORDER BY clause in an SQL statement?
A. Descending
B. Random
C. Ascending
D. Alphabetic only

Correct Answer: Option C


Explanation:
By default, the ORDER BY clause sorts the query results in ascending order unless specified otherwise using the DESC keyword.

This question belongs to: Computer Database Management System (DBMS)
Question #224
Which of the following is NOT an aggregate function in standard SQL?
A. AVG()
B. LENGTH()
C. COUNT()
D. SUM()

Correct Answer: Option B


Explanation:
SUM(), AVG(), and COUNT() are aggregate functions operating on multiple rows, whereas LENGTH() is a scalar function acting on a single text value.

This question belongs to: Computer Database Management System (DBMS)
Question #225
Which SQL keyword is placed immediately inside a SELECT statement or an aggregate function to eliminate duplicate rows from the output?
A. UNIQUE
B. SINGLE
C. DIFFERENT
D. DISTINCT

Correct Answer: Option D


Explanation:
The DISTINCT keyword is used to remove all duplicate values or records from the output of an SQL SELECT query.

This question belongs to: Computer Database Management System (DBMS)
Question #226
Which SQL wildcard character is used to match exactly one single character when using the LIKE operator?
A. Question mark (?)
B. Asterisk (*)
C. Underscore (*)
D. Percentage sign (%)

Correct Answer: Option C


Explanation:
In SQL pattern matching with the LIKE operator, the underscore (*) represents exactly one single character, while the percent sign (%) matches zero or more characters.

This question belongs to: Computer Database Management System (DBMS)
Question #227
Which wildcard character is used with the SQL LIKE operator to represent zero, one, or multiple characters?
A. Underscore (_)
B. Ampersand (&)
C. Percentage sign (%)
D. Hash (#)

Correct Answer: Option C


Explanation:
The percentage sign (%) is used as a wildcard character to match any sequence of zero or more characters in an SQL LIKE string comparison query.

This question belongs to: Computer Database Management System (DBMS)
Question #228
Which constraint ensures that a column cannot accept or store an unassigned or missing value?
A. DEFAULT
B. UNIQUE
C. CHECK
D. NOT NULL

Correct Answer: Option D


Explanation:
The NOT NULL constraint explicitly forces a column to always contain a value, preventing blank or NULL entries.

This question belongs to: Computer Database Management System (DBMS)
Question #229
Which type of integrity constraint ensures that a foreign key value must either match an existing primary key value in the parent table or be NULL?
A. Key Integrity
B. Domain Integrity
C. Entity Integrity
D. Referential Integrity

Correct Answer: Option D


Explanation:
Referential Integrity ensures that relationships between tables remain consistent, requiring a foreign key to point to a valid existing row in the referenced table.

This question belongs to: Computer Database Management System (DBMS)
Question #230
Which rule state that 'no component of a primary key can accept a NULL value'?
A. Entity Integrity Rule
B. Referential Integrity Rule
C. Domain Constraint Rule
D. Security Integrity Rule

Correct Answer: Option A


Explanation:
The Entity Integrity Rule states that a primary key column cannot contain NULL values, ensuring each row can be explicitly identified.

This question belongs to: Computer Database Management System (DBMS)
Question #231
What value represents missing, unknown, or inapplicable data in a relational database?
A. Blank Space (' ')
B. Zero (0)
C. Void
D. NULL

Correct Answer: Option D


Explanation:
NULL is a special marker used in SQL to indicate the absence of a value or that the data is missing, unknown, or not applicable.

This question belongs to: Computer Database Management System (DBMS)
Question #232
Which operator is specifically used to verify whether a column value contains a NULL entry?
A. IS NULL
B. = NULL
C. IN NULL
D. LIKE NULL

Correct Answer: Option A


Explanation:
Because NULL represents an unknown value, it cannot be compared using the equality operator (=). Instead, the special 'IS NULL' operator must be used.

This question belongs to: Computer Database Management System (DBMS)
Question #233
Which SQL command deletes all rows from a table without deleting the structural schema, cannot be rolled back easily in some systems, and does not fire delete triggers?
A. TRUNCATE
B. DELETE
C. DROP
D. REMOVE

Correct Answer: Option A


Explanation:
TRUNCATE is a DDL command that quickly removes all records from a table by deallocating the data pages, bypassing row-level logging and triggers while leaving the table structure intact.

This question belongs to: Computer Database Management System (DBMS)
Question #234
What is a virtual table that does not physically exist on storage but is defined by an underlying SQL query called?
A. View
B. Index
C. Stored Procedure
D. Trigger

Correct Answer: Option A


Explanation:
A View is a virtual, logical table derived from the result set of an SQL SELECT query. It behaves like a table but does not store data independently.

This question belongs to: Computer Database Management System (DBMS)
Question #235
Which database structure is created to drastically speed up the retrieval of rows from a table at the expense of slower data updates?
A. Index
B. Constraint
C. Schema
D. View

Correct Answer: Option A


Explanation:
An Index is a performance optimization structure created on table columns to search and locate matching rows quickly without performing a full table scan.

This question belongs to: Computer Database Management System (DBMS)
Question #236
A database object that automatically executes or fires in response to specific events (like INSERT, UPDATE, or DELETE) on a table is known as a what?
A. Cursor
B. Stored Procedure
C. View
D. Trigger

Correct Answer: Option D


Explanation:
A Trigger is a named database object containing procedural code that automatically runs or fires when a specific DML statement occurs on a designated table.

This question belongs to: Computer Database Management System (DBMS)
Question #237
The process of organizing a relational database schema to minimize data redundancy and prevent update anomalies is called what?
A. Generalization
B. Aggregation
C. Normalization
D. Denormalization

Correct Answer: Option C


Explanation:
Normalization is the systematic process of structuring relational database schemas to eliminate redundant data and maintain data integrity through decomposition.

This question belongs to: Computer Database Management System (DBMS)
Question #238
Which normal form requires that all attributes in a table contain only atomic, indivisible values, and prohibits multi-valued attributes?
A. Second Normal Form (2NF)
B. Third Normal Form (3NF)
C. Boyce-Codd Normal Form (BCNF)
D. First Normal Form (1NF)

Correct Answer: Option D


Explanation:
A relation is in First Normal Form (1NF) if and only if the domain of every attribute contains only atomic (indivisible) values, and no repeating groups exist.

This question belongs to: Computer Database Management System (DBMS)
Question #239
To be in Second Normal Form (2NF), a relation must already satisfy First Normal Form (1NF) and must completely eliminate what type of dependency?
A. Functional Dependency
B. Transitive Dependency
C. Partial Dependency
D. Multivalued Dependency

Correct Answer: Option C


Explanation:
Second Normal Form (2NF) requires that the table is in 1NF and that no non-prime attribute is partially dependent on any candidate key (meaning no partial dependency exists).

This question belongs to: Computer Database Management System (DBMS)
Question #240
A table is in Third Normal Form (3NF) if it is in 2NF and has absolutely no non-prime attributes that exhibit what type of dependency?
A. Trivial Dependency
B. Partial Dependency
C. Join Dependency
D. Transitive Dependency

Correct Answer: Option D


Explanation:
Third Normal Form (3NF) requires a relation to be in 2NF with no transitive dependencies, meaning non-prime attributes cannot be determined by other non-prime attributes.

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