SQL SELECT Statement

SQL SELECT Description

The SELECT statement is used to select data from the database.

The selected data is stored in a result table called a result set.


SELECT column1, column2, ...
FROM table_name

Here, column1, column2, ... are the field names of the table from which you want to select data. If you want to select all fields available in a table, use the following syntax:

FROM table_name

Demonstration database

The following is a sample from the "Customers" table of the "Northwind" database:

1Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.5021Mexico
3Antonio Moreno TaqueríaAntonio MorenoMataderos 2312México D.F.5023Mexico
4Around the HornThomas Hardy120 Hanover Sq.LondonWA1 1DPUK
5Berglunds snabbköpChristina BerglundBerguvsvägen 8LuleåS-958 22Sweden

SELECT Column Example

The following SQL statement selects the columns "CustomerName" and "City" from the table "Customers":

Run SQLSELECT CustomerName, City 
FROM Customers

SELECT * Example

The following SQL statement selects all columns from the Customers table:

FROM Customers