The SQL SELECT statement allows you to retrieve records from one or more tables in your SQL database. For SQL SELECT statements can be used with WHERE clauses and also using relationship by joining tables.
The result is stored in a result table, called the result-set.
The syntax for the SQL SELECT statement is:
Below SQL Statement is used to retrieve data from database based on column names.
SELECT column_name1, column_name2 FROM table_name;
Below SQL Statement is used to Select entire data from a database table.
SELECT * FROM table_name;
If you want to get data for only one record WHERE clause can be added to above SQL statement
SELECT * FROM table_name WHERE Id=1;
After adding WHERE clause, data can be retrieved from specific columns.
SELECT column_name1, column_name2 FROM table_name WHERE Id=1;
Using SELECT statement records can be retrieved from multiple tables using relationships between tables and by joining tables.