Learn more about SQL Server tools

 

Tutorials          DBA          Dev          BI          Career          Categories          Events          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Events

DBA    Dev    BI    Categories

 

SELECT command for SQL Server Tutorial



By:

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.






More SQL Server Solutions




Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Notify for updates 


Get free SQL tips:

*Enter Code refresh code     



Learn more about SQL Server tools