Skip to Content
SQL Server 2014 Development Essentials
book

SQL Server 2014 Development Essentials

by Basit A. Masood-Al-Farooq
July 2014
Intermediate to advanced
214 pages
4h 47m
English
Packt Publishing
Content preview from SQL Server 2014 Development Essentials

Organizing and grouping data

We can use the SELECT statement and its clauses and keywords to organize and summarize data. In this section, we will cover these clauses.

The ORDER BY clause

By default, when you query the data in a table with no clustered index, SQL Server does not guarantee the order in which data is returned and returns rows in a random order. If the table has a clustered index, SQL Server returns the rows in a clustered index order. Therefore, we use the ORDER BY clause in your SELECT statements to sort the data returned by the query based on the columns' sort order specified in the ORDER BY clause. The ORDER BY clause guarantees the order in which data is returned.

For example, to display a sales representative's sales-related information ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What's New in SQL Server 2012

What's New in SQL Server 2012

Rachel Horder
Mastering SQL Server® 2008

Mastering SQL Server® 2008

Michael Lee, Gentry Bieker
Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein

Publisher Resources

ISBN: 9781782172550Supplemental Content