Learn more about SQL Server tools

   
   























Latest from MSSQLTips















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







 

Follow

Get Free SQL Tips

Twitter

LinkedIn

Google+

Facebook

Pinterest

RSS

Learning

DBAs

Developers

BI Professionals

Careers

Q and A

Today's Tip

Resources

Tutorials

Webcasts

Whitepapers

Tools

Search

Tip Categories

Search By TipID

Authors

Community

First Timer?

Pictures

Free T-shirt

Contribute

Events

User Groups

Author of the Year

More Info

Join

About

Copyright

Privacy

Disclaimer

Feedback

Advertise

Copyright (c) 2006-2015 Edgewood Solutions, LLC All rights reserved
Some names and products listed are the registered trademarks of their respective owners.