Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
Readable column headers help consumers of query results and downstream tools. This question asks whether SQL supports assigning aliases (via AS) to expressions, including built-in function outputs.
Given Data / Assumptions:
Concept / Approach:
Aliases rename the output column: SELECT COUNT() AS order_count, UPPER(customer_name) AS customer_name_upper FROM ...; The AS keyword is optional in several DBMSs (you can write COUNT() order_count), but AS improves clarity. Aliases are also useful inside subqueries and common table expressions, where outer queries reference the alias.
Step-by-Step Solution:
Verification / Alternative check:
Run the query and inspect column headers in the result grid—aliases should appear as defined, aiding users and BI tools.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting that some DBMSs treat unquoted aliases as folded to lower/upper case depending on settings. Be consistent, especially when referencing aliases in ORDER BY.
Final Answer:
Correct
Discussion & Comments