1Z0-1119-1 practice question 10 of 10

Which SQL keyword is used to define a condition that must be met for a row to be included in the result set of a SELECT statement?

Full set: 40 questions
Answer options
A: WHERE Correct answer
B: GROUP
C: IF
D: HAVING
Correct Answer:
A. WHERE
Explanation

The WHERE clause is a fundamental component of the SQL SELECT statement used to filter records. It extracts only those rows from a table that fulfill a specified condition. The condition is evaluated for each row, and if the condition evaluates to true, the row is included in the result set. This filtering happens before any grouping or aggregation specified by clauses like GROUP BY.

Why Incorrect

B. The GROUP BY clause is used to arrange identical data into groups, often in conjunction with aggregate functions like COUNT() or SUM().
C. IF is not a standard SQL keyword for filtering rows in a SELECT statement's main structure; it's typically a function used within expressions (e.g., IF(condition, trueval, falseval)).
D. The HAVING clause is used to filter groups created by the GROUP BY clause based on an aggregate condition, not individual rows.

References

1. Oracle. (2024). Database SQL Language Reference, 23c. Oracle Help Center. Retrieved from https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/The-WHERE-Clause.html. (Section "The WHERE Clause" states, "The WHERE clause lets you restrict the rows returned by a query.").

2. Ramakrishnan, R., & Gehrke, J. (2003). Database Management Systems (3rd ed.). McGraw-Hill. (Chapter 5, "SQL: Queries, Constraints, Triggers," Section 5.2.2 "The WHERE Clause" explains its function as the primary mechanism for row selection based on conditions).

3. Stanford University. (n.d.). CS 145 Introduction to Databases - Lecture 3: Basic SQL. Retrieved from https://web.stanford.edu/class/cs145/slides/03-basic-sql.pdf. (Slide 10, "Selection: WHERE clause," describes its use for filtering rows).

Scroll to Top