(2026) Q&A | WGU
1. Which SQL clause is used to filter individual rows before any grouping or aggregation
occurs?
A) HAVING
B) WHERE
C) GROUP BY
D) ORDER BY
Correct Answer: WHERE
Rationale: The WHERE clause filters individual rows before grouping or aggregation
takes place. The HAVING clause filters groups after GROUP BY has been applied, GROUP BY
creates groups of rows, and ORDER BY sorts the final result set. Understanding the
sequence of clause evaluation is essential for writing correct queries.
2. What is the default sort order of the ORDER BY clause when no direction is specified?
A) Descending
B) Ascending
C) Random
D) No default; it throws an error
Correct Answer: Ascending
Rationale: The ORDER BY clause defaults to ascending order, from smallest to largest for
numeric values or A to Z for strings. Descending order must be explicitly specified with the
,DESC keyword. Random ordering requires a specific function and is not the default
behavior.
3. A table contains 100 rows, and 5 rows have NULL values in the salary column. What does
SELECT COUNT(*) FROM employees; return?
A) 95
B) 100
C) An error
D) 0
Correct Answer: 100
Rationale: COUNT(*) counts the total number of rows in a table, regardless of NULL
values in any column. In contrast, COUNT(salary) would exclude the 5 rows with NULL
values and return 95. This distinction is important when choosing between counting rows
and counting non-NULL values.
4. Which wildcard character in a SQL LIKE clause matches exactly one single character?
A) %
B) *
C) _ (underscore)
D) ?
Correct Answer: _ (underscore)
Rationale: In SQL LIKE patterns, the underscore matches exactly one character, while the
percent sign matches zero or more characters. The asterisk and question mark are used in
other contexts but are not standard SQL wildcards for the LIKE operator.
, 5. Which SQL command is used to permanently save a transaction?
A) SAVEPOINT
B) ROLLBACK
C) COMMIT
D) GRANT
Correct Answer: COMMIT
Rationale: COMMIT finalizes all changes made during the current transaction, making
them permanent in the database. ROLLBACK undoes changes, SAVEPOINT marks a point to
roll back to, and GRANT manages user permissions.
6. Which constraint explicitly prevents a column from storing NULL values?
A) CHECK
B) UNIQUE
C) NOT NULL
D) DEFAULT
Correct Answer: NOT NULL
Rationale: The NOT NULL constraint ensures that every row must contain a value for that
column. A CHECK constraint validates a condition, UNIQUE prevents duplicate values, and
DEFAULT provides a fallback value when none is supplied.
7. What is the primary purpose of a foreign key constraint in a relational database?
A) To ensure all values in a column are unique