Receive all updates via Facebook. Just Click the Like Button Below

Blogger Widgets
/

Watch Intro About My Website ! ! !

Sunday, 3 November 2013


The SQL SELECT Statement

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

SQL SELECT Syntax

SELECT column_name(s)
FROM table_name

                                 and

SELECT * FROM table_name
 

SQL SELECT Example


The "Persons" table:

Id
LastName
FirstName
Address
City
1
Navis
Anto
Madras
TVL
2
ji
Bala
Bombay
TVL
3
Christopher
Franklin
America
KK

Now we want to select the content of the columns named "LastName" and "FirstName" from the table above.

The result-set will look like this:


LastName
FirstName
Navis
Anto
ji
Bala
Christopher
Franklin

SELECT * Example

Now we want to select all the columns from the "Persons" table.
We use the following SELECT statement: 


SELECT * FROM Persons


Tip: The asterisk (*) is a quick way of selecting all columns!

The result-set will look like this:


Id
LastName
FirstName
Address
City
1
Navis
Anto
Madras
TVL
2
ji
Bala
Bombay
TVL
3
Christopher
Franklin
America
KK



Tagged:

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...