Chapter 11. Advanced data retrieval topics

After completing this chapter, you will be able to

  • Write PIVOT and UNPIVOT queries.

  • Write a paging query.

  • Write a common table expression.

  • Use a variable.

Chapter 10, provided a solid introduction to data retrieval using the SELECT query. In this chapter, you will build on that introductory knowledge and examine a few advanced topics that will enhance how you return the data and what data is returned. As you interact with Microsoft SQL Server data more and more, you may encounter situations in which the basic concepts are not enough. This chapter will supply you with additional skills to help you solve more advanced problems.

Pivoting and unpivoting data

The concept of pivoting data in SQL Server refers to restructuring ...

Get Microsoft® SQL Server® 2012 Step by Step 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.