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:

prod_name
--------------------
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 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.