Learn more about SQL Server tools

   
   























Latest SQL Server Tips














Free SQL Server Learning

Deploying Applications in Azure without Configuration Limitations

 

Get your SQL Server in shape this Spring with Spotlight on SQL Server

 

Accidental DBA or DBA We've got You Covered with SQL Diagnostic Manager

 

Upgrade Strategies for Highly Available SQL Server Environments















SELECT command for SQL Server




Overview
If you are starting to learn the T-SQL language then starting with the SELECT statement makes a great deal of sense.  The SELECT statement is the core command to access data in SQL Server.  The main components of a SELECT statement are:

  • Column listing - either specific columns or * (SELECT list)
    • When * is specified, then all columns from the tables included in the FROM clause are included
  • Table listing (FROM clause)
  • Filter logic (WHERE clause)
  • Summarize values (GROUP BY)
  • Filters the GROUP BY values (HAVING)
  • Sorting logic (ORDER BY)

SELECT can be combine with other statements to do the following:

  • JOINing data from multiple tables to build a single result set
  • INSERT with a SELECT statement to add records into an existing table
  • SELECT...INTO statement to create a new table based on the column list specification and enter records into the new table
  • UNION or UNION ALL command to have multiple set of logic returned in a single result set
  • Include an index hint to force a particular lock level or index usage for the query

You can either use the outline on the left or click on the arrows to the right or below to scroll through each of these topics.







 
Sponsor Information