SQL Basics | DML: Data Manipulation Language | SELECT

The SELECT statement is used to retrieve data from a database.

The returned data is stored in a result set.

SELECT syntax

SELECT column_name1, column_name2, ... FROM table_name;

Here, column_name1, column_name2, and so on are the names of the fields in the table from which data will be selected. They are called columns. To select all available fields from a table, use the following syntax.

SELECT * FROM table_name;

SELECT examples

Column example

SELECT column1, column2 FROM table_name;

Example

SELECT * FROM table_name;

You can load multiple columns at once, and you can select several pieces of data from a table.

SELECT demo

store_information table

store_name sales txn_date
Los Angeles 1500 Jan-05-2018
San Diego 250 Jan-07-2018
Los Angeles 300 Jan-08-2018
Boston 700 Jan-08-2018

sql

SELECT store_name FROM store_information;

Result

store_name
Los Angeles
San Diego
Los Angeles
Boston