nerdexam
CompTIA

DA0-001 · Question #327

Which of the following query statements would be used when filtering data in a relational database management system? (Choose two.)

The correct answer is B. HAVING C. WHERE. In a relational database management system, the WHERE clause filters individual rows before any grouping occurs, while the HAVING clause filters groups of rows based on aggregate functions. Both are used to restrict the data returned by a query.

Data Concepts and Environments

Question

Which of the following query statements would be used when filtering data in a relational database management system? (Choose two.)

Options

  • AORDER BY
  • BHAVING
  • CWHERE
  • DSELECT
  • EINSERT
  • FGROUP BY

How the community answered

(26 responses)
  • B
    92% (24)
  • D
    4% (1)
  • F
    4% (1)

Why each option

In a relational database management system, the WHERE clause filters individual rows before any grouping occurs, while the HAVING clause filters groups of rows based on aggregate functions. Both are used to restrict the data returned by a query.

AORDER BY

ORDER BY is used for sorting the result set, not for filtering which rows are included.

BHAVINGCorrect

The HAVING clause is used to filter groups of rows based on conditions applied to aggregate functions, after the GROUP BY clause has organized the rows into groups. For example, HAVING COUNT(*) > 10 filters groups that have more than 10 members.

CWHERECorrect

The WHERE clause is used to filter individual rows based on specified conditions before any grouping or aggregation takes place. For example, WHERE price > 50 selects only rows where the price column value is greater than 50.

DSELECT

SELECT is used for specifying which columns to retrieve from a table, not for filtering rows.

EINSERT

INSERT is a Data Manipulation Language (DML) statement used to add new rows to a table, not for filtering existing data.

FGROUP BY

GROUP BY is used to group rows that have the same values in specified columns into summary rows, not for filtering rows based on conditions.

Concept tested: SQL data filtering clauses

Source: https://learn.microsoft.com/en-us/sql/t-sql/queries/where-transact-sql?view=sql-server-ver16

Topics

#SQL#Data Filtering#Database Queries#Relational Databases

Community Discussion

No community discussion yet for this question.

Full DA0-001 Practice