Retrieving Individual Columns

We'll start with a simple SQL SELECT statement, as follows:

SELECT prod_name
FROM Products;

The statement above uses the SELECT statement to retrieve a single column called prod_name from the products table. The desired column name is specified right after the SELECT keyword, and the FROM keyword specifies the name of the table from which to retrieve the data. The output from this statement is shown following:

Fish bean bag toy
Bird bean bag toy
Rabbit bean bag toy
8 inch teddy bear
12 inch teddy bear
18 inch teddy bear
Raggedy Ann

A simple SELECT statement similar to the one used above returns all the rows in a table. Data is not filtered, nor is it sorted. We'll discuss these ...

Get Sams Teach Yourself SQL in 10 Minutes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.