Choosing Columns: The SELECT Clause

The first clause of the SELECT statement—the one that begins with the keyword SELECT—is required in all SELECT statements. The keywords ALL and DISTINCT, which specify whether duplicate rows are to be included in the results, are optional. DISTINCT and ALL are discussed in the next chapter.

The select_list specifies the columns you want to see in the results. It can consist of these items individually or together:

  • An asterisk, shorthand for all the columns in the table, displayed in CREATE TABLE order

  • One or more column names, in any order

  • One or more character constants (such as “Total”) used as display headings or text embedded in the results

  • One or more SQL functions (AVG) and arithmetic operators, generally ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.