Choosing All Columns: SELECT *

The asterisk (*) has a special meaning in the select_list. It stands for all the column names in all the tables in the table list. The columns are displayed in the order in which they appeared in the CREATE TABLE statement(s). Most people read a SELECT * statement as “select star.” Use it when you want to see all the columns in a table.

The general syntax for selecting all the columns in a table is this:

SELECT *
FROM table/view_list

Because SELECT * finds all the columns currently in a table, changes in the structure of a table (adding, removing, or renaming columns) automatically modify the results of a SELECT *. Listing the columns individually gives you more precise control over the results, but SELECT * saves ...

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.