Database querying: which statement accurately describes what queries can do in a database system, focusing on capabilities such as calculations and summaries?
-
AQueries are written in unconstrained, free-form English sentences
-
BQueries can compute aggregates such as SUM, COUNT, AVG, MIN, and MAX
-
CQueries must be handwritten machine code to be efficient
-
DQueries cannot perform calculations; they only fetch raw rows
-
ENone of the above
Answer
Correct Answer: Queries can compute aggregates such as SUM, COUNT, AVG, MIN, and MAX
Explanation
Introduction / Context:Queries are the primary mechanism to retrieve and analyze data. In relational systems, SQL enables both selection of rows and computation of summaries. Understanding the difference between natural language and structured query languages helps set realistic expectations about what query tools provide out of the box.
Given Data / Assumptions:
- We assume a standard relational DBMS with SQL.
- Aggregates like SUM, COUNT, AVG, MIN, MAX are available.
- Some tools provide “English-like” syntaxes, but production systems rely on structured statements.
Concept / Approach:SQL supports aggregation, grouping, filtering, and joins. While end-user tools may offer natural-language layers, core DBMS engines expect structured syntax. Queries do much more than fetch rows: they can calculate totals, averages, and other statistics within the database for performance and correctness.
Step-by-Step Solution:
Identify the capability under discussion: aggregates. Recall that SQL provides GROUP BY and aggregate functions. Eliminate statements that confuse natural language with SQL or deny calculations. Select the option with aggregate capability.Verification / Alternative check:Select queries in analytics routinely compute SUM/COUNT/AVG directly in the database layer.
Why Other Options Are Wrong:
- (a): Production querying typically uses structured syntax, not free-form English.
- (c): Queries are not written in machine code.
- (d): Incorrect—queries can calculate aggregates.
- (e): Invalid; (b) is correct.
Common Pitfalls:Expecting DBMSs to interpret arbitrary natural language; overlooking the power of GROUP BY and aggregates.
Final Answer:Queries can compute aggregates such as SUM, COUNT, AVG, MIN, and MAX