How to pivot rows to columns (and back) in SQL: Databases for Developers #14

Опубликовано: 31 Октябрь 2024
на канале: The Magic of SQL
11,124
97

Sometimes you want to convert rows to columns. Or convert columns back into rows.

Luckily SQL has two clauses to help you do this:

PIVOT & UNPIVOT

Using these you can easily transform your rows to columns and back again.

Want more?

Take the course:
https://devgym.oracle.com/pls/apex/dg...

Read the blog post: https://blogs.oracle.com/sql/how-to-c...

Read the docs:

PIVOT: https://docs.oracle.com/en/database/o...

UNPIVOT: https://docs.oracle.com/en/database/o...

Need help with SQL? Ask us over on AskTOM: https://asktom.oracle.com

Twitter:   / chrisrsaxon  
Daily SQL Twitter tips:   / sqldaily  
All Things SQL blog: https://blogs.oracle.com/sql/

============================
The Magic of SQL with Chris Saxon

Copyright © 2015 Oracle and/or its affiliates. Oracle is a registered trademark of Oracle and/or its affiliates. All rights reserved. Other names may be registered trademarks of their respective owners. Oracle disclaims any warranties or representations as to the accuracy or completeness of this recording, demonstration, and/or written materials (the “Materials”). The Materials are provided “as is” without any warranty of any kind, either express or implied, including without limitation warranties or merchantability, fitness for a particular purpose, and non-infringement.