What does 'SELECT' do in SQL?
Instruction: Describe the function of the SELECT statement in SQL.
Context: This question tests the candidate's knowledge of basic SQL commands and their ability to retrieve data from a database.
Updated
Official Answer
SELECT specifies the columns or expressions in a query result. A query can retrieve rows from tables, join related data, filter rows and compute aggregates.
For a simple PostgreSQL example:
SELECT 2 + 3 AS total;
This returns one row with total = 5; a table is not required for this expression. In a table query, prefer the needed column names over * when a stable output contract matters. SELECT does not imply a result order: use ORDER BY when order is required.