Learn more about SQL Server tools



solving sql server problems for millions of dbas and developers since 2006
join MSSQLTips for free SQL Server tips



































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







Copyright (c) 2006-2014 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | about
authors | contribute | feedback | giveaways | user groups | community | events | first timer?
Some names and products listed are the registered trademarks of their respective owners.