Chapter 3. Filtering and Sorting Data

Exam objectives in this chapter:

  • Work with Data

    • Query data by using SELECT statements.

    • Implement data types.

  • Modify Data

    • Work with functions.

Filtering and sorting data are the most foundational, as well as most common, aspects of querying data. Almost every query that you write needs to filter data, and many queries involve sorting. The traditional way to filter data in T-SQL is based on predicates. However, T-SQL also supports filtering data based on another concept—a specified number of rows and ordering. The options T-SQL supports based on this concept are TOP and OFFSET-FETCH. As for sorting, even though it might seem like a trivial aspect of querying, it’s actually a source for quite a lot of confusion and ...

Get Training Kit (Exam 70-461): Querying Microsoft® SQL Server® 2012 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.