The mighty Transact-SQL SELECT

You probably already know that the most important SQL statement is the mighty SELECT statement you use to retrieve data from your databases. Every database developer knows the basic clauses and their usage:

  • SELECT to define the columns returned, or a projection of all table columns
  • FROM to list the tables used in the query and how they are associated, or joined
  • WHERE to filter the data to return only the rows that satisfy the condition in the predicate
  • GROUP BY to define the groups over which the data is aggregated
  • HAVING to filter the data after the grouping with conditions that refer to aggregations
  • ORDER BY to sort the rows returned to the client application

Besides these basic clauses, SELECT offers a ...

Get SQL Server 2017 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.