Latest updates

[5]

SQL Select Statement

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

SQL Select Syntax

 SELECT column_name(s)  FROM table_name


SQL SELECT Example:

“Persons” TABLE:
P_Id
LastName
FirstName
Address
City
1
Suhail
Osmani
Maharaj Nagar
Sitapur
2
Maxwel
Tom
Biswan
Sitapur
3
Rahi
Ayon
Okhla
Delhi
Now we want to select the content of the columns named "LastName" and "FirstName" from the table above. We use the following SELECT statement:
SELECT LastName,FirstName FROM Persons
Output:
LastName
FirstName
Suhail
Osmani
Maxwel
Tom
Rahi
Ayon

Note:    SELECT *    select all the columns from “Persons” TABLE. The asterisk (*) is a quick way of selecting all columns!

We use the following SELECT statement: 
SELECT * FROM Persons
Output:
P_Id
LastName
FirstName
Address
City
1
Suhail
Osmani
Maharaj Nagar
Sitapur
2
Maxwel
Tom
Biswan
Sitapur
3
Rahi
Ayon
Okhla
Delhi
SQL Select Statement SQL Select Statement Reviewed by Admin on 04:54:00 Rating: 5

No comments:

Sora Templates