Databases MCQs – Set-1 | 50 questions on relational design, SQL, constraints, transactions, indexing, and database models.
Mixed difficulty · Select one answer and open each explanation to review the concept.
What software manages database storage and queries?
A Database management system
B Operating system shell
C Network interface card
D Text editor
Answer: A. Database management system. A database management system stores, organizes, retrieves, and manages database data.
How does a relational database commonly organize records?
A As audio streams
B Tables of rows and columns
C As network packets
D In image layers
Answer: B. Tables of rows and columns. Relational databases organize data in tables made up of rows and columns.
What does a row represent in a relational table?
A A database license
B A query condition
C One record
D A table relationship
Answer: C. One record. A row represents one record or tuple in a relational table.
What does a column describe in a table?
A A whole database backup
B A transaction boundary
C A database user
D An attribute of records
Answer: D. An attribute of records. A column represents an attribute or field shared by the table’s records.
Why assign a primary key to a table?
A Uniquely identify each row
B Compress every stored value
C Sort all rows permanently
D Encrypt every column
Answer: A. Uniquely identify each row. A primary key uniquely identifies each row in a table.
What does a foreign key commonly reference?
A A database backup file
B Related table key
C A query’s output format
D A server’s network address
Answer: B. Related table key. A foreign key references a key in another or the same table to define a relationship.
What does a database schema describe?
A Only the latest data values
B The server’s physical location
C Database structure and definitions
D The users’ passwords
Answer: C. Database structure and definitions. A schema describes structures such as tables, columns, constraints, and relationships.
Which language is widely used to query relational databases?
A HTML
B CSS
C XML
D SQL
Answer: D. SQL. SQL is the standard language family used to define, query, and modify relational data.
Which SQL command retrieves rows from a table?
A SELECT
B INSERT
C DELETE
D UPDATE
Answer: A. SELECT. SELECT retrieves rows from one or more tables or views.
What does a WHERE clause do in a query?
A Sorts results by date
B Filters rows by conditions
C Creates a new database
D Changes a table’s schema
Answer: B. Filters rows by conditions. WHERE restricts query results to rows that satisfy a condition.
Which clause sorts query results?
A HAVING
B GROUP BY
C ORDER BY
D FROM
Answer: C. ORDER BY. ORDER BY sorts result rows by one or more expressions.
Which SQL command adds new rows?
A DELETE
B SELECT
C ALTER
D INSERT
Answer: D. INSERT. INSERT adds rows to a table.
What does UPDATE do in SQL?
A Changes existing rows
B Creates a database user
C Retrieves matching rows
D Removes a table index
Answer: A. Changes existing rows. UPDATE modifies values in existing rows.
Which command removes selected table rows?
A INSERT
B DELETE
C SELECT
D CREATE
Answer: B. DELETE. DELETE removes rows that match its conditions.
Why use a JOIN in a relational query?
A To compress stored data
B To encrypt a table
C Combine rows using related values
D To create a user account
Answer: C. Combine rows using related values. A JOIN combines rows from tables using a related condition.
What does an INNER JOIN return?
A Every row from both tables
B Only unmatched rows
C Every left-table row
D Rows with matching join values
Answer: D. Rows with matching join values. An inner join returns rows for which the join condition matches.
How does a LEFT JOIN treat the left table?
A Keeps all its rows
B Keeps only unmatched rows
C Deletes its duplicate rows
D Sorts it alphabetically
Answer: A. Keeps all its rows. A left join keeps every row from the left side and includes matching right-side data when available.
What does GROUP BY prepare rows for?
A File compression
B Grouping and aggregation
C User authentication
D Database backup
Answer: B. Grouping and aggregation. GROUP BY forms groups of rows, often for aggregate calculations.
Which clause filters grouped results?
A WHERE
B ORDER BY
C HAVING
D LIMIT
Answer: C. HAVING. HAVING filters groups after grouping and aggregation.
Which aggregate function counts rows?
A SUM
B AVG
C MAX
D COUNT
Answer: D. COUNT. COUNT returns the number of rows or non-null values, depending on its form.
In SQL, what does NULL generally represent?
A Missing or unknown value
B The number zero
C An empty table
D A false constraint
Answer: A. Missing or unknown value. NULL represents an absent or unknown value; it is not the same as zero.
How should a query test for NULL values?
A Use equal-to zero
B Use IS NULL
C Use ORDER BY NULL
D Use COUNT NULL
Answer: B. Use IS NULL. SQL uses IS NULL to test whether a value is null.
What does a database constraint do?
A Speeds up every query
B Creates an application screen
C Enforces data rules
D Stores database backups
Answer: C. Enforces data rules. Constraints enforce rules that keep table data valid.
Which constraint prevents duplicate values in a column or set?
A CHECK only
B DEFAULT
C FOREIGN KEY only
D UNIQUE
Answer: D. UNIQUE. A UNIQUE constraint prevents duplicate key values across the constrained column or columns.
What does NOT NULL require?
A Required non-null value
B Two table keys
C A query must return rows
D Database uses SQL
Answer: A. Required non-null value. NOT NULL prevents a column from containing null values.
What is a composite key made from?
A One database index
B Multiple columns together
C A query and a view
D Several database servers
Answer: B. Multiple columns together. A composite key uses two or more columns together to identify a row.
How is a many-to-many relationship commonly represented?
A By duplicating every database
B With one nullable column
C Using an association table
D By deleting the foreign keys
Answer: C. Using an association table. An association table stores links between rows from the two related tables.
Why normalize relational tables?
A To increase duplicate data
B To eliminate all keys
C To prevent all joins
D Reduce redundancy and update anomalies
Answer: D. Reduce redundancy and update anomalies. Normalization organizes data to reduce avoidable duplication and modification anomalies.
What does first normal form generally require?
A Atomic values in each field
B A single row per database
C No primary keys
D Every column to be numeric
Answer: A. Atomic values in each field. First normal form requires each field to hold an atomic value rather than a repeating group.
What is a database transaction?
A A table’s display theme
B Logical database work unit
C A network connection type
D A database user role
Answer: B. Logical database work unit. A transaction groups database operations into a logical unit of work.
Which properties are summarized by ACID?
A Access, consistency, indexing, durability
B Accuracy, compression, isolation, deletion
C Atomicity, consistency, isolation, durability
D Authentication, caching, integrity, delivery
Answer: C. Atomicity, consistency, isolation, durability. ACID describes atomicity, consistency, isolation, and durability properties of transactions.
What does transaction atomicity mean?
A Queries always run instantly
B Data is always duplicated
C All users see identical screens
D Work happens entirely or not
Answer: D. Work happens entirely or not. Atomicity means a transaction’s work is treated as all-or-nothing.
What does consistency require of a transaction?
A Preserve database rules
B Delete every old row
C Avoid all concurrent work
D Disable foreign keys
Answer: A. Preserve database rules. Consistency means a transaction moves the database from one valid state to another while preserving constraints.
What does transaction isolation address?
A How tables are named
B How concurrent transactions interact
C Where backups are stored
D Which columns are visible
Answer: B. How concurrent transactions interact. Isolation controls how concurrent transactions observe and affect one another.
What does durability promise after commit?
A Queries become private
B Indexes no longer change
C Committed data persists
D All locks remain forever
Answer: C. Committed data persists. Durability means committed changes persist despite later failures, subject to the system’s guarantees.
Which command confirms a transaction’s changes?
A ROLLBACK
B SAVEPOINT
C EXPLAIN
D COMMIT
Answer: D. COMMIT. COMMIT makes a transaction’s changes permanent according to the database system’s transaction rules.
What does ROLLBACK do to an uncommitted transaction?
A Undoes its pending changes
B Creates a new index
C Sorts its query results
D Copies rows to another table
Answer: A. Undoes its pending changes. ROLLBACK discards changes made by the current uncommitted transaction.
What is a database index designed to improve?
A Query searches and lookups
B Every write operation
C Database network security
D The number of stored columns
Answer: B. Every write operation. Indexes can speed up data retrieval, though they consume storage and can add write overhead.
What does a query planner choose?
A Which users may log in
B How many tables exist
C Execution strategy for query
D A database’s display theme
Answer: C. Execution strategy for query. A query planner selects a plan for retrieving or changing data.
What is a database view commonly based on?
A A physical network cable
B A backup archive
C A primary key alone
D A stored query definition
Answer: D. A stored query definition. A regular view presents results based on a stored query definition.
How does a materialized view differ from a regular view?
A It stores query results
B It cannot be refreshed
C It contains no columns
D It is always a backup
Answer: A. It stores query results. A materialized view stores query results and may need refreshing to reflect newer base-table data.
Which model uses flexible non-relational data structures?
A Relational only
B NoSQL
C SQL-only view
D File allocation table
Answer: B. NoSQL. NoSQL is a broad group of database systems that do not use only the traditional relational table model.
What does a document database usually store?
A Only numeric indexes
B Rows with fixed columns only
C Structured documents such as JSON
D Only graph edges
Answer: C. Structured documents such as JSON. Document databases store records as structured documents, often in JSON-like formats.
Which database model retrieves values using unique keys?
A Graph database
B Relational database
C Time-series database
D Key-value database
Answer: D. Key-value database. Key-value databases retrieve stored values by their associated keys.
What do graph databases emphasize?
A Nodes and relationships
B Tables and fixed columns only
C Rows without links
D Files and directories
Answer: A. Nodes and relationships. Graph databases represent entities as nodes and their connections as relationships or edges.
What is a data warehouse primarily built to support?
A Rapid keyboard input
B Analytics across collected data
C Operating-system startup
D Network cable testing
Answer: B. Analytics across collected data. A data warehouse integrates data for reporting and analytical work.
Which workload focuses on frequent business transactions?
A OLAP
B Batch rendering
C OLTP
D Image compression
Answer: C. OLTP. OLTP workloads process frequent operational transactions such as orders or account updates.
What is database replication?
A Deleting duplicate records
B Combining SQL clauses
C Grouping rows by column
D Maintaining copies across systems
Answer: D. Maintaining copies across systems. Replication maintains copies of data on multiple database systems.
What does database sharding do?
A Distributes data across partitions
B Converts SQL into HTML
C Removes all indexes
D Encrypts only passwords
Answer: A. Distributes data across partitions. Sharding divides data across partitions or nodes to distribute storage and workload.
Why maintain a database backup?
A To increase query complexity
B To restore data after loss
C To replace every transaction
D To remove database constraints
Answer: B. To restore data after loss. Backups preserve recoverable copies of data in case of deletion, corruption, or system failure.