Advanced Grouping, Windowed Aggregation, and OLAP in SQL
Most SQL programmers work with OLTP (Online Transaction Processing) databases and have had no exposure to Online Analytic Processing (OLAP) and data warehousing. OLAP is concerned with summarizing and reporting data, so the schema designs and common operations are very different from the usual SQL queries.
As a gross generalization, everything you knew in OLTP is reversed in a data warehouse.
1. OLTP changes data in short, frequent transactions. A data warehouse is bulk loaded with static data on a schedule. The data remains constant once it is in place.
2. OLTP databases want to store only the data needed to do its current work. A data warehouse wants all the historical data it can ...