What is SQL SELECT statement?

The SQL SELECT statement is used to fetch data from a database table which returns the data in the form of a result table. These result tables are called result sets.

Basic syntax

SELECT column1, column2, column3 FROM table_name;

The query contains two keywords – SELECT and FROM. The SELECT keyword means that we want to select/display/generate a result set from the listed columns –¬†column1, column2, column3. The FROM keyword specifies the source of the selected columns (in this case this is the name of the table). If we want to select all of the columns we can use the symbol “*” as shown below:

SELECT * FROM table_name;


Lets have a demo table called Persons:


If we execute any of following queries:

SELECT * FROM Persons;
SELECT Id, Name, Age FROM Persons;

We will get the same result – the whole data from the table.

If we want to select only the names of the persons we can execute:

SELECT Name FROM Persons;

Was this article helpful?