Task 3 - SQL SELECT Statement

Post Reply
User avatar
Mayank
Site Admin
Posts: 229
Joined: 06 Oct 2017, 11:19
Status: Offline

10 Oct 2017, 10:03

The SQL SELECT StatementThe SELECT statement is used to select data from a database.The data returned is stored in a result table, called the result-set.SELECT Syntax

Code: Select all

SELECT [i]column1[/i],[i] column2, ...[/i]
FROM [i]table_name[/i];
Here, column1, column2, ... are the field names of the table you want to select data from. If you want to select all the fields available in the table, use the following syntax:
 

Code: Select all

SELECT * FROM [i]table_name[/i];

Demo DatabaseBelow is a selection from the "Customers" table in the Northwind sample database:Image
SELECT Column ExampleThe following SQL statement selects the "CustomerName" and "City" columns from the "Customers" table:Example

Code: Select all

SELECT CustomerName, City FROM Customers;
Try it Yourself »

SELECT * ExampleThe following SQL statement selects all the columns from the "Customers" table:Example

Code: Select all

SELECT * FROM Customers;
Try it Yourself »
Mayank Goyal

Post Reply
Actuarial Blogs Insurology

icon icon