Database Fundamentals and SQL MCQs Practice Set for November 11, 2026
This independent practice set focuses on database fundamentals and introductory SQL for learners preparing for computer-science entry tests, including NAT-ICS-style study. It moves from core terminology and relational keys to normalization, queries, joins, constraints, and transaction concepts. The questions are practice material, not a claim about any official test syllabus; check the latest official notice for test arrangements and covered topics.
Why this Database Fundamentals and SQL set is useful
Work through 100 original database and SQL MCQs with four options and explanations. The set covers relational database vocabulary, keys, normalization, basic SQL statements, filtering, grouping, joins, constraints, and transactions. Use the explanations to identify whether an error came from a concept, a query rule, or a calculation. Start with this focused set, then continue with the MCQsBase question bank, online quiz practice, past papers, and the complete MCQsBase blog.
Test focus topics
| No. | Focus Area | What to Practice |
|---|---|---|
| 1 | Database foundations | Distinguish data from information, DBMS functions, schemas, tables, records, fields, and domains. |
| 2 | Relational keys and design | Identify primary, candidate, composite, and foreign keys, and recognize common normalization goals. |
| 3 | SQL fundamentals | Read SELECT statements, conditions, sorting, aggregate functions, and grouped queries. |
| 4 | Joins and constraints | Predict which rows joins return and understand common table constraints. |
| 5 | Transactions and indexes | Review transaction properties, commit and rollback, and the basic purpose of indexes. |
What this set covers
| Section | Questions | Focus |
|---|---|---|
| Set 1 | 1-20 | Core Database Fundamentals and SQL fundamentals |
| Set 2 | 21-40 | Foundational test concepts |
| Set 3 | 41-60 | Mixed exam-style practice |
| Set 4 | 61-80 | Fast recall and elimination practice |
| Set 5 | 81-100 | Final revision and score-building |
Choose one option, then check the bold answer.
Which statement best distinguishes data from information?
Correct Answer
A) Data are raw facts; information is data processed into a meaningful form.
Data are recorded facts or observations. Organizing or interpreting them to provide meaning produces information.
What is the main role of a database management system (DBMS)?
Correct Answer
A) To manage the creation, storage, retrieval, and control of database data
A DBMS provides facilities for defining, accessing, and managing data. It does not make data unchangeable or replace the operating system.
In a relational database, a table is also commonly called a:
Correct Answer
A) Relation
The relational model represents data as relations, commonly displayed as tables of rows and columns.
In a relational table, one row describing one entity or event is called a:
Correct Answer
A) Tuple
A tuple is a row in a relation. A column is an attribute, while a domain is the set of permitted values for an attribute.
In a table, what does an attribute represent?
Correct Answer
A) A column describing a property
An attribute represents a property recorded for each tuple and is typically shown as a table column.
What is a domain in the relational model?
Correct Answer
A) The permitted set of values for an attribute
An attribute's domain defines the values considered valid for it, such as integers or a restricted set of codes.
What does a database schema primarily describe?
Correct Answer
A) The database's structure and defined objects
A schema describes structures such as tables, columns, and constraints. The data currently stored is the database state or instance.
What is a database instance in this context?
Correct Answer
A) The data stored in the database at a particular time
An instance is the database's current contents at a given moment; the schema is its defined structure.
Which is a typical benefit of storing related records in a database rather than separate, uncontrolled files?
Correct Answer
A) Centralized control can help reduce inconsistent duplicate data.
Shared database management can reduce needless duplication and improve consistency. It does not remove the need for validation, security, or performance planning.
Which key is selected to identify each row uniquely in a table?
Correct Answer
A) Primary key
A primary key identifies rows uniquely and cannot contain a NULL value in the relational model.
A table has two different minimal column sets that each uniquely identify every row. What are both sets called before one is chosen as the primary key?
Correct Answer
A) Candidate keys
Each minimal unique identifier is a candidate key. One candidate is selected as the primary key.
A key consists of both StudentID and CourseID because neither column alone uniquely identifies an enrolment. What kind of key is it?
Correct Answer
A) Composite key
A composite key contains more than one attribute. Here the pair identifies each enrolment even though either component alone does not.
In an Enrolment table, StudentID refers to Student.StudentID. What role does Enrolment.StudentID play?
Correct Answer
A) Foreign key
A foreign key refers to a key in another table, helping represent and enforce a relationship between the tables.
Which property is required of a primary key value in each row?
Correct Answer
A) It must be unique and non-NULL.
A primary key must distinguish each row, so duplicate and NULL key values are not permitted.
A table's chosen primary key uses StudentNumber, but Email is also unique and non-NULL. How is Email best described?
Correct Answer
A) An alternate candidate key
Email is another candidate key; because StudentNumber was selected as the primary key, Email is an alternate candidate key.
What does a referential-integrity rule generally require of a non-NULL foreign-key value?
Correct Answer
A) It matches a referenced key value in the related table.
Referential integrity prevents a foreign key from referring to a missing parent row, subject to the database's defined rules.
A column is constrained to contain no duplicate values. Which common SQL constraint expresses this rule?
Correct Answer
A) UNIQUE
A UNIQUE constraint disallows duplicate values in the constrained column or column combination. Its NULL handling can vary by DBMS.
A table requires every row to have a value in its ContactName column. Which constraint expresses this requirement?
Correct Answer
A) NOT NULL
NOT NULL requires a value for that column. A DEFAULT supplies a value when one is omitted but does not express the same rule.
Which statement about a foreign key is generally correct?
Correct Answer
A) It may contain repeated values when several rows refer to the same parent.
Many child rows can refer to one parent row, so a foreign key is often repeated. It need not be the child table's primary key.
Which issue is most directly associated with a repeating group in a table, such as storing Phone1, Phone2, and Phone3 for the same kind of value?
Correct Answer
A) The structure is not in first normal form.
First normal form requires values in each row-column position to be atomic in the intended model, rather than storing repeating groups of the same attribute.
Choose one option, then check the bold answer.
A relation is in first normal form when, among other requirements, each field contains:
Correct Answer
A) One atomic value for that row and column
First normal form avoids repeating groups and multivalued fields by representing each field with one value in the chosen relational design.
For a table with a composite candidate key, what does second normal form rule out?
Correct Answer
A) Partial dependency of a non-key attribute on only part of a candidate key
Second normal form requires first normal form and removes partial dependencies of non-key attributes on a proper subset of a candidate key.
A relation is in third normal form, under the usual introductory definition, if it is in second normal form and has no:
Correct Answer
A) Transitive dependency of a non-key attribute on a key
Third normal form removes non-key attributes that depend transitively on a key through another non-key attribute.
In a table keyed by (StudentID, CourseID), suppose StudentName depends only on StudentID. What design issue does this illustrate?
Correct Answer
A) Partial dependency
StudentName depends on only part of the composite key, StudentID, rather than the whole key; this is the partial-dependency issue addressed by second normal form.
In a relation, suppose EmployeeID determines DepartmentID and DepartmentID determines DepartmentName. If EmployeeID is the key, what dependency of DepartmentName on EmployeeID is illustrated?
Correct Answer
A) Transitive dependency
EmployeeID determines DepartmentName through DepartmentID. The non-key attribute is therefore transitively dependent on the key.
Which problem can arise when the same department name is repeated in every employee row and is updated inconsistently?
Correct Answer
A) Update anomaly
Duplicated facts can require multiple updates; if some copies are missed, the database holds conflicting values.
A department's details cannot be stored until at least one employee is assigned to it. Which common anomaly is this?
Correct Answer
A) Insertion anomaly
An insertion anomaly occurs when a design makes it difficult to record one fact without also recording an unrelated fact.
Deleting the last employee row also unintentionally removes the only stored details of that employee's department. What is this called?
Correct Answer
A) Deletion anomaly
A deletion anomaly loses a separate fact as a side effect of deleting a row that combines multiple kinds of information.
Which SQL statement is used to retrieve rows from a table?
Correct Answer
A) SELECT
SELECT retrieves data. INSERT adds rows, UPDATE changes existing values, and DROP removes a database object.
Which SQL statement adds a new row to a table?
Correct Answer
A) INSERT
INSERT adds rows to a table. SELECT reads rows, while ALTER changes a database object's definition.
Which SQL statement changes existing values in selected rows?
Correct Answer
A) UPDATE
UPDATE modifies values in rows that meet its conditions. A missing or incorrect WHERE condition can affect unintended rows.
Which SQL statement removes selected rows from a table while leaving the table definition in place?
Correct Answer
A) DELETE
DELETE removes row data. DROP removes a database object itself, including its definition.
Which SQL command is commonly classified as a data-definition language (DDL) command?
Correct Answer
A) CREATE TABLE
CREATE TABLE defines a database structure, so it is DDL. SELECT, INSERT, and UPDATE operate on data.
Which SQL command is commonly classified as a data-manipulation language (DML) command?
Correct Answer
A) INSERT
INSERT manipulates table data. CREATE, ALTER, and DROP define or change database objects.
Which clause chooses the columns to appear in a query result?
Correct Answer
A) SELECT
The SELECT list specifies the output expressions or columns; WHERE filters rows and ORDER BY sorts the result.
Which clause filters individual rows before grouping in a basic SELECT query?
Correct Answer
A) WHERE
WHERE filters rows before grouping and aggregation. HAVING filters groups after grouping.
Which clause sorts the rows returned by a query?
Correct Answer
A) ORDER BY
ORDER BY specifies result ordering. Without it, a query does not promise a particular row order.
In standard SQL usage, what does DISTINCT do in SELECT DISTINCT City FROM Customers?
Correct Answer
A) Returns each distinct City value once in the result
DISTINCT removes duplicate result rows for the selected expression; it does not alter the stored table or itself specify sorting.
A query must return employees whose salary is greater than 50000. Which condition is appropriate?
Correct Answer
A) WHERE Salary > 50000
The greater-than comparison in WHERE retains rows whose Salary exceeds 50000; it excludes a salary equal to 50000.
Which condition selects rows where Status is either Active or Pending?
Correct Answer
A) WHERE Status = 'Active' OR Status = 'Pending'
A row can have either value, so OR is required. With AND, the same Status value would have to equal both strings simultaneously.
Choose one option, then check the bold answer.
Which SQL condition tests whether a column has no value represented as NULL?
Correct Answer
A) ColumnName IS NULL
SQL uses IS NULL to test for NULL. Equality comparisons with NULL do not provide the intended test.
Which condition finds names beginning with the letters Al using the SQL LIKE pattern convention?
Correct Answer
A) Name LIKE 'Al%'
In LIKE patterns, percent represents zero or more characters, so Al% matches strings that begin with Al.
In a LIKE pattern, what does the underscore wildcard commonly match?
Correct Answer
A) Exactly one character
The underscore wildcard represents one character. Percent, by contrast, represents zero or more characters.
Which clause groups rows that share the same value in a selected column?
Correct Answer
A) GROUP BY
GROUP BY forms groups with matching values, usually so aggregate functions can calculate one result per group.
Which clause is used to filter groups based on an aggregate result such as COUNT(*)?
Correct Answer
A) HAVING
HAVING filters groups after aggregation; WHERE filters individual rows before groups are formed.
A query groups orders by CustomerID and should keep customers with at least three orders. Which condition belongs in HAVING?
Correct Answer
**A) HAVING COUNT(*) >= 3**
The count is computed per group, so the group-level condition uses HAVING rather than WHERE.
What does COUNT(*) count in a query over a set of rows?
Correct Answer
A) The number of rows
COUNT(*) counts rows, including rows that contain NULL in some columns.
What does COUNT(Email) count in a SQL query?
Correct Answer
A) Rows where Email is not NULL
COUNT(column) ignores NULL values in that column. Use COUNT(DISTINCT Email) when distinct non-NULL values are required.
For a set of non-NULL numeric values, what does AVG(Score) calculate?
Correct Answer
A) Their arithmetic mean
AVG returns the arithmetic average of non-NULL input values. It is not the median or count.
Which aggregate function returns the largest value in a set of comparable values?
Correct Answer
A) MAX
MAX returns the greatest value in the group or result set; MIN returns the smallest.
If a query uses SUM(Amount), which kind of column is normally appropriate for Amount?
Correct Answer
A) A numeric column
SUM adds numeric values. A text label or SQL keyword is not a meaningful amount to add.
A table has values 4, 7, and 9 in its non-NULL Score rows. What is AVG(Score)?
Correct Answer
A) 6.67 approximately
The mean is (4 + 7 + 9) / 3 = 20/3, approximately 6.67; 7 is the middle value, not the mean.
What does a basic INNER JOIN return for two tables joined on a matching key?
Correct Answer
A) Rows with matching join values in both tables
An INNER JOIN keeps combinations whose join condition matches. Unmatched rows are excluded.
What is the main purpose of a LEFT JOIN?
Correct Answer
A) Keep every left-table row and include matching right-table data when available
A LEFT JOIN preserves all rows from the left input; columns from the right side are NULL when there is no match.
What result does a CROSS JOIN produce for two input tables?
Correct Answer
A) The Cartesian product of their rows
A CROSS JOIN pairs each row of one table with every row of the other. If they contain m and n rows, the result has m × n rows.
Table A has 3 rows and table B has 5 rows. How many row combinations does their CROSS JOIN produce?
Correct Answer
A) 15
A Cartesian product has 3 × 5 = 15 combinations. Adding the row counts would give 8, not the product.
In a join between Orders and Customers, which condition most directly pairs each order with its customer?
Correct Answer
A) Orders.CustomerID = Customers.CustomerID
The shared customer identifier links each order to its customer. Comparing unrelated attributes would not define that relationship.
A row from the left table has no match in the right table in a LEFT JOIN. What is returned for the right-table columns in that result row?
Correct Answer
A) NULL values
The left row remains, and the unavailable right-side values are represented as NULL in the join result.
What does an alias do in a SQL query such as Employees AS e?
Correct Answer
A) Gives a table or expression a temporary name within the query
An alias is a query-level shorthand or output label; it does not by itself rename the stored table.
Which SQL set operator combines result rows from two compatible queries and removes duplicate rows by default?
Correct Answer
A) UNION
UNION combines compatible result sets and removes duplicates by default. UNION ALL retains duplicates.
Choose one option, then check the bold answer.
What must generally be true for the two SELECT statements combined by UNION?
Correct Answer
A) They return the same number of columns with compatible corresponding data types.
UNION aligns columns by position, so the result sets need matching column counts and compatible types in corresponding positions.
Which statement about a subquery is correct?
Correct Answer
A) It is a query nested within another SQL statement.
A subquery is nested inside a larger statement and can return one value, multiple values, or rows depending on its form.
Which operator is commonly used to test whether a value matches any value returned by a list-producing subquery?
Correct Answer
A) IN
IN tests membership in a specified list or subquery result. It is not a data-definition or transaction command.
A column Age should accept only values from 0 through 120 inclusive. Which constraint is designed to restrict allowed values with a condition?
Correct Answer
A) CHECK
A CHECK constraint enforces a condition on column or row values, such as Age BETWEEN 0 AND 120.
What does a DEFAULT constraint or default definition generally do when an INSERT omits that column?
Correct Answer
A) Supplies a predefined value for the omitted column
A default is used when a value is omitted, subject to the DBMS and statement details. It does not automatically copy unrelated table data.
Which SQL constraint is specifically used to require that a column value match a key in a referenced table?
Correct Answer
A) FOREIGN KEY
A foreign-key constraint links a referencing column or columns to a key in another or the same table.
What is the main purpose of an index on a database table?
Correct Answer
A) To help locate rows more efficiently for suitable queries
Indexes can speed up certain searches and joins, but they use storage and can add cost to data changes; they do not accelerate every query.
What is one common trade-off of adding indexes to a table?
Correct Answer
A) They can improve some reads but add storage and maintenance work.
Indexes can help query performance, but they take space and need updating when indexed data changes.
Which transaction property means that a transaction's changes are treated as an all-or-nothing unit?
Correct Answer
A) Atomicity
Atomicity means either all operations in the transaction take effect or none do.
Which ACID property requires a transaction to preserve defined database rules when it completes successfully?
Correct Answer
A) Consistency
Consistency means a successful transaction takes the database from one valid state to another, preserving applicable constraints.
Which ACID property concerns concurrent transactions behaving without improperly interfering with one another?
Correct Answer
A) Isolation
Isolation governs how concurrent transactions interact. The exact guarantees depend on the chosen isolation level and DBMS.
Which ACID property means committed changes should persist despite a subsequent system failure?
Correct Answer
A) Durability
Durability is the persistence of committed changes. It is distinct from atomicity, which concerns all-or-nothing execution.
What does COMMIT generally do at the end of a transaction?
Correct Answer
A) Makes the transaction's changes permanent according to the DBMS transaction rules
COMMIT completes a transaction and makes its changes durable under the database's transaction behavior.
What does ROLLBACK generally do to uncommitted changes in a transaction?
Correct Answer
A) Undoes them
ROLLBACK cancels uncommitted work in the transaction, returning the database to its earlier transactional state.
Which database model organizes data primarily as tables connected through keys?
Correct Answer
A) Relational model
The relational model represents data with relations and connects related records through keys and defined relationships.
In an entity-relationship diagram, what does an entity usually represent?
Correct Answer
A) A distinguishable real-world object or concept about which data is stored
Entities represent things or concepts such as Student or Course; their properties are represented by attributes.
In an entity-relationship model, an attribute is best understood as:
Correct Answer
A) A property describing an entity
Attributes describe entities, such as a Student's name or a Course's title.
If each department can have many employees and each employee belongs to one department, what is the relationship from Department to Employee?
Correct Answer
A) One-to-many
One department may be associated with many employees, while each employee is associated with one department in the stated model.
If students can take many courses and each course can have many students, what relationship exists between Student and Course?
Correct Answer
A) Many-to-many
Each side can be linked to multiple instances on the other side, so the relationship is many-to-many.
How is a many-to-many relationship commonly represented in a relational database?
Correct Answer
A) With an associative table containing foreign keys to the two related tables
An associative table stores each link as a row and commonly uses the two foreign keys together as its key.
Choose one option, then check the bold answer.
Which SQL keyword introduces the table or tables from which a SELECT query reads data?
Correct Answer
A) FROM
FROM identifies the source table or tables for a SELECT query. SET is commonly used in UPDATE assignments.
A query uses SELECT Name FROM Student WHERE City = 'Lahore'. What determines which Student rows are included?
Correct Answer
A) The WHERE condition on City
WHERE filters rows to those whose City matches Lahore. SELECT Name controls which value is displayed for each qualifying row.
What is the effect of omitting a WHERE clause from a basic UPDATE statement?
Correct Answer
A) The update can affect every row in the target table.
Without a filtering condition, an UPDATE generally applies its assignments to all rows, so conditions should be checked carefully.
What is the effect of omitting a WHERE clause from a basic DELETE statement?
Correct Answer
A) It can delete every row from the target table.
A DELETE without a row filter generally removes all table rows, while leaving the table structure in place.
Which query fragment sorts Salary from highest to lowest?
Correct Answer
A) ORDER BY Salary DESC
DESC requests descending order, so larger salaries appear before smaller ones; ASC is ascending order.
Which query fragment sorts a column in ascending order?
Correct Answer
A) ORDER BY Name ASC
ASC specifies ascending order in ORDER BY. It is commonly the default, but stating it makes the intended order explicit.
A query needs rows with Salary between 30000 and 50000, including both endpoints. Which condition is correct?
Correct Answer
A) Salary BETWEEN 30000 AND 50000
BETWEEN includes both endpoints in SQL, so this condition includes salaries of exactly 30000 and 50000.
Which condition selects records where Age is not 18?
Correct Answer
A) Age <> 18
The standard SQL not-equal operator is <>. It tests values different from 18, subject to SQL's handling of NULL.
Which statement about SQL NULL is most accurate?
Correct Answer
A) It represents missing or unknown information and is not the same as zero.
NULL marks an absent or unknown value. Its behavior differs from zero and from an empty string.
Which logical operator requires both conditions to be true for a row to pass the condition?
Correct Answer
A) AND
AND is true only when both conditions are true. OR requires at least one condition to be true.
Which logical operator is used to reverse a condition's truth value?
Correct Answer
A) NOT
NOT negates a condition. For example, NOT (Age = 18) is true when that equality condition is false.
A table contains 12 rows, of which 3 have NULL in the Email column. What does COUNT(Email) return?
Correct Answer
A) 9
COUNT(Email) excludes the 3 NULL values, so it counts 12 - 3 = 9 non-NULL entries.
A table has 8 rows, including 2 rows where every value in the selected column is NULL. What does COUNT(*) return?
Correct Answer
A) 8
COUNT(*) counts all rows regardless of NULL values, so the result is 8.
A GROUP BY query selects DepartmentID and COUNT(*). What does each output row normally represent?
Correct Answer
A) One department group and its row count
GROUP BY DepartmentID forms one group per department value, and COUNT(*) reports the number of rows in each group.
Which clause should be used to require each grouped DepartmentID to have a COUNT(*) greater than 5?
Correct Answer
**A) HAVING COUNT(*) > 5**
The condition applies to an aggregate for each group, so HAVING is appropriate.
What does a view commonly represent in a relational database?
Correct Answer
A) A named query that presents data derived from one or more sources
A view presents selected or derived data through a stored query; whether it is updateable depends on its definition and DBMS.
Which statement best describes a database backup?
Correct Answer
A) A separate copy used to help restore data after loss or damage
Backups provide a recovery copy. Their usefulness depends on suitable storage, schedules, and restoration testing.
A database rule requires a product's Price to be greater than or equal to zero. Which design feature is most appropriate?
Correct Answer
A) A CHECK constraint on Price
A CHECK constraint can enforce Price >= 0 when data is inserted or changed.
Which feature most directly ensures that two rows in a table cannot share the same selected identifier?
Correct Answer
A) A primary-key constraint
A primary key enforces unique, non-NULL identification of rows. Sorting or defaults do not establish uniqueness.
In a Student table, StudentID is the primary key and ClassID references Class.ClassID. Which statement best describes ClassID in Student?
Correct Answer
A) It is a foreign key that can link multiple students to one class.
Many students may share a class, so the foreign key can repeat while referring to the class table's key.
How to revise this Database Fundamentals and SQL set
- For each key question, state what must be unique and whether the key connects one table to another; do not treat every unique column as a primary key.
- When practising normalization, write down the functional dependency first, then check whether the issue is a repeating group, partial dependency, or transitive dependency.
- Read SQL clauses in their logical purpose: filter rows with WHERE, filter groups with HAVING, and sort the final result with ORDER BY.
- For join questions, sketch the matching key values and check whether unmatched rows should remain in the result.
- When reviewing an incorrect answer, write a small example table and manually predict the result before memorizing a rule.
Frequently Asked Questions
Are these official NAT-ICS questions?
No. They are original independent practice questions on database fundamentals and SQL, not copied from an official paper or confirmed syllabus.
What should I know before attempting the SQL questions?
Basic familiarity with tables, rows, columns, and simple conditions is enough. The explanations introduce the query rules used in the answers.
Why does COUNT(column) sometimes give a different result from COUNT(*)?
COUNT(*) counts rows, while COUNT(column) counts only rows where that column is not NULL. Check which measure a question asks for.
How can I review normalization questions effectively?
Identify the table's key and its dependencies, then ask whether attributes depend on the whole key and nothing but the key. Use the explanation to classify the design issue.
Final Takeaway
Consistent daily MCQ practice is one of the simplest ways to improve recall, speed, and exam confidence. Bookmark this page, complete the 100 Database Fundamentals and SQL MCQs, and continue your preparation on McqsBase.