O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving Columns with SELECT and FROM

In its simplest form, a SELECT statement retrieves columns from a table; you can retrieve one column, multiple columns, or all columns. The SELECT clause lists the columns to display, and the FROM clause specifies the table from which to draw the columns.

To retrieve a column from a table:

  • Type:
    SELECT column
      FROM table;
    
    column is a column name, and table is the name of the table that contains column (Listing 4.1 and Figure 4.1).
Listing 4.1. List the cities in which the authors live. See Figure 4.1 for the result.
SELECT city
  FROM authors;
Figure 4.1. Result of Listing 4.1.
city
-------------
Bronx
Boulder
San Francisco
San Francisco
New York
Palo Alto
Sarasota

To retrieve multiple columns ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required