SQL SELECT Statement
The SQL SELECT statement is used to select data from a database, and the data returned is stored in a result table, called the result-set.
- The SELECT statement retrieves data from a database.
- The data is returned in a table-like structure called a result-set.
- SELECT is the most frequently used action on a database.
Syntax of SQL SELECT Statement
SELECT column_list FROM table_name;
SELECT * FROM table_name;
A query may retrieve information from specified columns or from all of the columns in the table. To create a simple SQL SELECT Statement, you must specify the column(s) name and the table name.
Employee Table
A sample of EMPLOYEE records table & the name of table Employee. The column(s) of the Employee table [ID, EMPLOYEE_NAME, EMPLOYEE_EMAIL, ADDRESS, CITY, and COUNTRY]:
ID |
EMPLOYEE_NAME |
EMPLOYEE_EMAIL |
ADDRESS |
CITY |
COUNTRY |
1 |
Mark J. |
mark@gmail.com |
House 53, Sq. |
London |
U.K. |
2 |
Lack Josh |
lackjosh@gmail.com |
2745 road mark |
Delhi |
India |
3 |
Kim Juhu |
kimjuhu@gmail.com |
Street 587327, 34 House |
Seoul |
South Korea |
4 |
Jack Jenifer |
jenifer@gmail.com |
464673 Mataderos |
Mexico D.F. |
Mexico |
5 |
McKinley |
mckinley@gmail.com |
54, Road Washington |
Washington |
U.S. |
6 |
Alena |
aln@gmail.com |
House No. 6563 |
Tokyo Japan |
Japan |
7 |
Mack Marina |
mmk@gmail.com |
43 Road, NH |
San Francisco |
U.S. |
8 |
Dipak Jha |
jha@gmail.com |
Mahanager, 26 Road |
Lucknow |
India |
Select Query with Multiple Column
In this SELECT statement, we SELECT three column - Address, City and Country. How to look table ofter using query, it mentioned below:
SELECT Address, City, Country FROM Employee
Result
Address |
City |
Country |
House 53, Sq. |
London |
UK |
2745 road mark |
Delhi |
India |
Street 587327, 34 House |
Seoul |
South Korea |
464673 Mataderos |
Mexico D.F. |
Mexico |
54, Road Washington |
Washington |
U.S. |
House No. 6563 |
Tokyo Japan |
Japan |
43 Road, NH |
San Francisco |
U.S. |
Mahanager, 26 Road |
Lucknow |
India |