SELECT statement is the most commonly used SQL command. The SELECT statement is used to access and retrieve data from database. A SELECT statement prompts the server to prepare result and return it to the client application. The keywords SELECT, FROM and WHERE make up the basic SELECT statement.
SELECT column_name1,column_name2 FROM table_name;
SELECT * FROM table_name;
Consider PUBLISHERS table is having following records:
Example 1: SELECT PUB_ID, PUB_NAME FROM PUBLISHERS
The above statement retrieves the PUB_ID and PUB_NAME from the PUBLISHERS table.
Example 2: SELECT * FROM PUBLISHERS
The above statement lists all the rows along with all the columns specified at the time of creation of the PUBLISHERS table.