SQL SELECT Statement


The SQL SELECT statement is the most frequently used SQL query or command. It is used to fetch or retrieve all data (columns and rows) or partial (specific columns) data from a database table.

The SQL SELECT command returns matched query data in the form of table (rows and columns).
These tables are called result set or result table.


Search Keys

  • sql select query
  • select statement
  • sql select table
  • sql server select where
  • sql unique select
  • select tables from database
  • select statement in sql
  • sql command select
  • select sql query
  • sql query select where
  • select 1 sql
  • sql select examples
  • sql server select example
  • sql select where syntax
  • select sql database
  • basic sql select statements
  • select syntax sql server
  • sql select command examples
  • mssql select syntax
  • sql select on select
  • sql select query examples
  • syntax of select statement

Sql Select Query Syntax

The below syntax is used to select specific column(s) from the specific table.


SELECT 
column_name1, column_name2, column_nameN 
FROM table_name;

The below syntax is used to select all column(s) from the specific table.


SELECT * FROM table_name;

Note:- You can write all SQL statements in a single line or multiple line.

  • SELECT - The SELECT command specifies the list of columns that are retrieved from the table.
  • FROM - The FROM command specifies from where data should be retrieved.

Sample Database Table - Books

BookID BookName BookPrice
1 Easy Oracle PL/SQL Programming 195
2 Professional MySql 150
3 Foundations Of Sql Server 2008 145
4 Making Sense Of SQL 165

SELECT Specific Column Example

The following SQL SELECT statement selects the "BookName" and "BookPrice" columns from the "Books" table:


SELECT 
BookName, BookPrice 
FROM Books;

Note: Column names are separated by commas(,).

The result of above query is:


SELECT * Example

The following SQL SELECT statement selects all the column names or fields of "Books" table:


SELECT * FROM Books;

Note: '*' is a special characters, which is used to select all columns from the table.

The result of above query is:


Search Keys

  • sql select in select statement
  • sql select from table where
  • multiple select sql
  • select update sql
  • sql select where in list
  • sql select values
  • sql select as table
  • sql select row
  • retrieve sql
  • sql retrieve data
  • retrieve data from sql
  • retrieve data from sql database
  • sql query to retrieve data from table
  • sql query to retrieve data
  • select from query
  • sql multiple select
  • sql select into table
  • sql select field
  • sql select specific columns
  • select into existing table
  • select unique sql
  • sql server select from where
  • select into variable