MariaDB and MySQL common table Expressions and Window functions revealed / Daniel Batholomew
- Author:
- Bartholomew, Daniel
- Published:
- Berkeley, CA : Apress, [2017]
- Physical Description:
- 1 online resource
Access Online
- Contents:
- Contents at a Glance -- Contents -- About the Author -- About the Technical Reviewer -- Acknowledgments -- Introduction -- Syntax -- Part I: Common Table Expressions -- Chapter 1: Basics of Common Table Expressions -- Before We Begin -- What Are Common Table Expressions? -- Basic CTE Syntax -- The Motivation for CTEs -- Temporary -- Readable -- Using in One or Many Places -- Permissions -- Nesting -- Multiplexing -- Recursion -- Summary -- Chapter 2: Non-recursive Common Table Expressions -- Before We Begin, Using CTEs for Year-over-Year ComparisonsComparing Individuals Against Their Group -- Translating Subqueries into CTEs -- Summary -- Chapter 3: Recursive Common Table Expressions -- Before We Begin -- Recursive CTE Syntax -- Adding Numbers -- Calculating Fibonacci Numbers -- Looking Up Ancestors in a Tree -- Finding All Possible Destinations -- Finding All Possible Paths -- Summary -- Part II: Window Functions -- Chapter 4: Basics of Window Functions -- What Is a function? -- Window Function Syntax -- Partition Definition Syntax, Order Definition SyntaxFrame Definition Syntax -- WINDOW Clause Syntax -- Window Functions Reference -- AVG() -- BIT_AND() -- BIT_OR() -- BIT_XOR() -- COUNT() -- CUME_DIST() -- DENSE_RANK() -- FIRST_VALUE() -- LAG() -- LAST_VALUE() -- LEAD() -- NTH_VALUE() -- NTILE -- PERCENT_RANK() -- RANK() -- ROW_NUMBER() -- SUM() -- Summary -- Chapter 5: Recognizing Opportunities for Window Functions -- Partitioning and Ordering Results -- Maintaining a Running Total -- Ranking Rows in a Result Set -- Summary, and Chapter 6: Window Functions in PracticeBefore We Begin -- Working with Time-Series Data -- Using Multiple Window Functions at Once -- Graphing Time-Series Results -- Analyzing Fruit Sales -- Fruit Sales Within a Single Store -- Comparing Fruit Sales Across All Stores -- Summary -- Chapter 7: Combining Window Functions and CTEs -- Before We Begin -- Compute the Average Time Between Days with Precipitation -- Adding a Primary Key Column -- Finding Gaps and Islands -- Gaps -- Islands -- Summary
- Summary:
- Walk away from old-fashioned and cumbersome query approaches and answer your business intelligence questions through simple and powerful queries built on common table expressions (CTEs) and window functions. These new features in MariaDB and MySQL help you to write queries without having to wade through a quagmire of brittle self-joins and other crazy techniques from the past. Your queries will generate correct results, be more readable and less brittle in the face of unexpected data, and you'll be able to adapt them quickly in the face of changing business requirements. MariaDB and MySQL Common Table Expressions and Window Functions Revealed introduces and explains CTEs and window functions, newly available in MariaDB 10.2 and MySQL 8.0, and helps you understand why and how every MariaDB and MySQL database programmer should learn and apply these features in their daily work. CTEs and especially window functions enable easy solutions to many query challenges that in prior releases have been difficult and sometimes impossible to surmount. Mastering these features opens the door to query solutions that are more robust, execute faster, and are easier to maintain over time than prior solutions using older techniques. The book: Takes you step-by-step through the workings of common table expressions and window functions Provides easy-to-follow examples of the new syntax Helps you answer business questions faster and easier than ever What You'll Learn: Answer business questions using simple queries that don't break in the face of unexpected data Avoid writing queries that are a difficult-to-maintain quagmire of self-joins and nested subqueries Recognize situations that call for window functions, and learn when to use these features Reduce the need for performance-robbing self-joins Simplify and speed the execution of analytical queries Create queries that finish in seconds instead of hours.
- Subject(s):
- ISBN:
- 9781484231203 (electronic bk.)
1484231201 (electronic bk.)
1484231198
9781484231197 - Digital File Characteristics:
- text file
PDF - Bibliography Note:
- Includes bibliographical references and index.
View MARC record | catkey: 37444881