Retrieve data
Use the SELECT statement to retrieve one or more data columns from the table.
SELECT statement
SQL statements are composed of simple English words. These words are called keywords, and each SQL statement is composed of one or more keywords. Probably, the most frequently used SQL statement is the SELECT statement. Its purpose is to retrieve information from one or more tables.
In order to use SELECT to retrieve table data, at least two pieces of information must be given—what you want to choose, and from where.
Retrieve a single column
Let's start with a simple SQL SELECT statement, this statement is as follows:
Input
SELECT prod_name FROM products;
analysis
The above statement uses the SELECT statement to retrieve a column named prod_name from the products table. The required column names are given after the SELECT keyword, and the FROM keyword indicates the name of the table from which to retrieve data.
Output