SELECT is a simple and most frequently used command in SQL Server.

SELECT Command is used to retrieve data from one or more table based. Required Data can be selected / retrieved from database by applying different conditional clause like TOP,WHERE, GROUP BY, HAVING etc.,

Syntax for SELECT Command is as follows:

SELECT <Column list> from <Table>

Example : SELECT Col1, Col2 from SAMPLE

Above statement will select Col1 and Col2 from SAMPLE table.

To select all the columns and rows from a table in a single shot following statement can be used:

SELECT * FROM <Table Name>


Above statement will retrieve complete information from SAMPLE table.

Below picture indicates the difference between above 2 syntax's:

This entry was posted in . Bookmark the permalink.

One Response to SELECT in SQL SERVER

  1. FUll syntax of the SELECT statement is complex, but the main clauses can be summarized as:

    [WITH [CTE(comman Table Experssion)]]
    SELECT [columns List] [INTO [New Table Name]]
    FROM [table NAME]
    WHERE [Selection Criteria]
    GROUP BY [Group By Expression]
    HAVING [Selection Criteria]
    ORDER BY [order expression] [ ASC | DESC ]

    The UNION, EXCEPT and INTERSECT operators can be used between queries to combine or compare their results into one result set.