sql select statement

SQL Basic

homeBack

Next

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 (1)

    Table Name ” emp”

    S.no Name1 Name2 City
    2458 Peter Jhon Hyderabad
    4857 Faran Khan New York
    5874 Raj Kiran London
    8578 Sameer Ali Mumbai

    We use the following SELECT statement: 

    SELECT Name1,Name2 FROM emp

    Result:

    Name1 Name2
    Peter Jhon
    Faran Khan
    Raj Kiran
    Sameer Ali

  • SQL SELECT EXAMPLE (2):

    We use the following SELECT statement: 

     SELECT * FROM table_name 

    Result

    S.no Name1 Name2 City
    2458 Peter Jhon Hyderabad
    4857 Faran Khan New York
    5874 Raj Kiran London
    8578 Sameer Ali Mumbai

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s