Vertica Architecture and SQL Training (VER101)
Course Length: 3 days
Delivery Methods:
Available as private class only
Course Overview
In this training class, students will learn the Vertica Architecture and SQL starting at the most basic level and going to the most advanced level with many examples.
Course Benefits
- Gain a deeper knowledge and understanding of the Vertica Architecture and SQL and how to write it.
Course Outline
- What is Columnar?
- What is Parallel Processing?
- Nothing Happens on Disk
- Data in Memory is Fast as Lightning
- Parallel Processing Of Data
- The Problem With Row-Based Data
- Columnar Data Can Store Each Column in Their Own Block
- Why Columnar?
- Row Based Blocks vs. Columnar Based Blocks
- Visualize the Data - Rows vs. Columns
- The Architecture of Vertica
- Vertica Architecture Terms
- Vertica has Linear Scalability
- Vertica Data Distribution
- Distribution Strategy 1 - Segmented By Hash
- Distribution Strategy 2 - Unsegmented
- Sorting the Data in a Table CREATE Statement
- Even Distribution
- Uneven Distribution Where the Data is Non-Unique
- Matching Distribution Keys for Co-Location of Joins
- Big Table / Small Table Joins
- Fact and Dimension Table Distribution Key Designs
- Why a Sort Key Improves Performance
- Sort Keys Help Group By, Order By and Window Functions
- Clever Features of Vertica
- Super Projections
- Vertica Projections
- The Five Advantages of Projections
- Creating a Projection
- Read-Optimized Store (ROS)/Write-Optimized Store (WOS)
- Write-Optimized Store (WOS) is Memory Resident
- Updates are Collected in Time-Based Buckets called Epochs
- Vertica Does Not Support In-Place Updates
- K-Safety
- K-Safety of 2
- The Five Data Isolation Modes
- Import/Export Between Multiple Vertica Systems
- Roles
- Compression
- Runlength encoding
- LZO Encoding
- Delta Encoding
- Block Based Dictionary Encoding for Character Data
- Nexus on Vertica
- Nexus is Available on the Cloud
- Nexus Queries Every Major System
- Setup of Nexus is as Easy as Pie
- Setup of Nexus is a Easy as 1, 2, 3
- Nexus Data Visualization
- Nexus Data Visualization
- Nexus Data Visualization Shows What Tables Can Be Joined
- Nexus is Doing a Five-Table Join
- Nexus Generates the SQL Automatically
- Nexus Delivers the Report
- Cross-System Joins From Teradata, Oracle and SQL Server
- The Tabs of the Super Join Builder
- The 9 Tabs of the Super Join Builder - Objects Tab 1
- Selecting Columns in the Objects Tab
- The 9 Tabs of the Super Join Builder - Columns Tab 2
- Removing Columns From the Report in the Columns Tab
- The 9 Tabs of the Super Join Builder - Sorting Tab 3
- The 9 Tabs of the Super Join Builder - Joins Tab 4
- The 9 Tabs of the Super Join Builder - Where Tab 5
- Using the WHERE Tab For Additional WHERE or AND
- The 9 Tabs of the Super Join Builder - Analytics Tab 9
- Analytics Tab
- Analytics Tab - OLAP Example
- Analytics Tab - OLAP Example of SQL Generated
- Analytics Tab - Grouping Sets Example
- Analytics Tab - Grouping Sets Answer Set
- Nexus Data Movement
- Moving a Single Table To a Different System
- The Single Table Data Movement Screen
- Moving an Entire Database To a Different System
- The Database Mover Screen
- The Database Mover Options Tab
- Converting DDL Table Structures
- Converting DDL Table Structures
- Converting DDL Table Structures
- Compare and Synchronize
- Compare Two Different Databases From Different Systems
- Comparisons Down to the Column Level
- The Results Tab
- View Differences
- Synchronizing Differences In the Results Tab
- Synchronizing Differences In the Results Tab
- Hound Dog Compression
- Hound Dog Compression
- The Basics of SQL
- Introduction
- Setting your Path
- Setting Your Default Database
- SELECT * (All Columns) in a Table
- Fully Qualifying a Database, Schema and Table
- SELECT Specific Columns in a Table
- Commas in the Front or Back?
- Place your Commas in front for better Debugging Capabilities
- Sort the Data with the ORDER BY Keyword
- ORDER BY Defaults to Ascending
- Use the Name or the Number in your ORDER BY Statement
- Two Examples of ORDER BY using Different Techniques
- Changing the ORDER BY to Descending Order
- NULL Values sort First in Ascending Mode (Default)
- NULL Values sort Last in Descending Mode (DESC)
- Major Sort vs. Minor Sorts
- Multiple Sort Keys using Names vs. Numbers
- Sorts are Alphabetical, NOT Logical
- Using A CASE Statement to Sort Logically
- How to ALIAS a Column Name
- A Missing Comma can by Mistake become an Alias
- Aliasing a Column Name With Spaces or Reserved Words
- Comments using Double Dashes are Single Line Comments
- Comments for Multi-Lines
- Comments for Multi-Lines As Double Dashes Per Line
- Formatting Number
- Formatting Number Examples
- Formatting Dates
- Formatting Date Example
- The WHERE Clause
- The WHERE Clause limits Returning Rows
- Double Quoted Aliases are for Reserved Words and Spaces
- Character Data needs Single Quotes in the WHERE Clause
- Character Data needs Single Quotes, but Numbers Don’t
- Comparisons against a Null Value
- NULL means UNKNOWN DATA so Equal (=) won’t Work
- Use IS NULL or IS NOT NULL when dealing with NULLs
- NULL is UNKNOWN DATA so NOT Equal won’t Work
- Use IS NULL or IS NOT NULL when dealing with NULLs
- Using Greater Than or Equal To (>=)
- AND in the WHERE Clause
- Troubleshooting AND
- OR in the WHERE Clause
- Troubleshooting Or
- Troubleshooting Character Data
- Using Different Columns in an AND Statement
- What is the Order of Precedence?
- Using Parentheses to change the Order of Precedence
- Using an IN List in place of OR
- The IN List is an Excellent Technique
- IN List vs. OR brings the same Results
- The IN List Can Use Character Data
- Using a NOT IN List
- Null Values in a NOT IN List Bring Back No Rows
- A Technique for Handling Nulls with a NOT IN List
- BETWEEN is Inclusive
- NOT BETWEEN is Also Inclusive
- LIKE uses Wildcards Percent ‘%’ and Underscore ‘_’
- LIKE command Underscore is Wildcard for one Character
- LIKE Command Works Differently on Char Vs Varchar
- LIKE Command on Character Data Auto Trims
- Numbers are Right Justified and Character Data is Left
- An Example of Data with Left and Right Justification
- A Visual of CHARACTER Data vs. VARCHAR Data
- Use the TRIM command to remove spaces on CHAR Data
- Escape Character in the LIKE Command changes Wildcards
- Escape Characters Turn off Wildcards in the LIKE Command
- The Distinct Command
- Distinct vs. GROUP BY
- Aggregation
- The 3 Rules of Aggregation
- There are Five Aggregates
- Troubleshooting Aggregates
- GROUP BY when Aggregates and Normal Columns Mix
- GROUP BY delivers one row per Group
- GROUP BY Dept_No or GROUP BY 1 the same thing
- Limiting Rows and Improving Performance with WHERE
- WHERE Clause in Aggregation limits unneeded Calculations
- Keyword HAVING tests Aggregates after they are Totaled
- Keyword HAVING is like an Extra WHERE Clause for Totals
- Keyword HAVING tests Aggregates after they are Totaled
- Getting the Average Values Per Column
- Average Values Per Column For all Columns in a Table
- Group By Rollup
- GROUP BY Rollup Result Set
- Join Functions
- A Two-Table Join Using Traditional Syntax
- A two-table join using Non-ANSI Syntax with Table Alias
- You Can Fully Qualify All Columns
- A two-table join using ANSI Syntax
- Both Queries have the same Results and Performance
- LEFT OUTER JOIN
- LEFT OUTER JOIN Results
- RIGHT OUTER JOIN
- RIGHT OUTER JOIN Example and Results
- FULL OUTER JOIN
- FULL OUTER JOIN Results
- Which Tables are the Left and which Tables are Right?
- INNER JOIN with Additional AND Clause
- ANSI INNER JOIN with Additional AND Clause
- ANSI INNER JOIN with Additional WHERE Clause
- OUTER JOIN with Additional WHERE Clause
- OUTER JOIN with Additional AND Clause
- OUTER JOIN with Additional AND Clause Results
- Evaluation Order for Outer Queries
- The DREADED Product Join
- The DREADED Product Join Results
- The Horrifying Cartesian Product Join
- The ANSI Cartesian Join will ERROR
- The CROSS JOIN
- The CROSS JOIN Answer Set
- The SelfJoin
- The SelfJoin with ANSI Syntax
- How would you Join these two tables?
- An Associative Table is a Bridge that Joins Two Tables
- The Nexus Query Chameleon Writes the SQL for Users
- Date Functions
- Current_Date
- Current_Date, Current_Time And Current_Timestamp
- Timestamp Differences
- Getdate
- Date and Time Keywords
- Using CAST in Literal Values
- Add or Subtract Days from a date
- Formatting Dates
- Formatting Date Example
- A Summary of Math Operations on Dates
- The ADD_MONTHS Command
- Using the ADD_MONTHS Command to Add 1 Year
- Using the ADD_MONTHS Command to Add 1 Year
- Using the ADD_MONTHS Command to Add 5 Years
- Using the ADD_MONTHS Command to Add 5 Years
- The EXTRACT Command
- YEAR, MONTH, and DAY Functions
- A Better Technique for YEAR, MONTH, and DAY Functions
- Another Version of the EXTRACT Command
- EXTRACT from DATES and TIME
- Why EXTRACT is a Better Form
- EXTRACT with DATE and TIME Literals
- EXTRACT of the Month on Aggregate Queries
- AGE_IN_MONTHS
- AGE_IN_YEARS
- DATE_TRUNC
- DATEDIFF
- DAYOFWEEK
- Intervals for Date, Time and Timestamp
- Interval Data Types and the Bytes to Store Them
- Using Intervals
- How a Simple Interval Handles Leap Year
- Interval Arithmetic Results
- A Time Interval Example
- A DATE Interval Example Going Back in Time
- A Complex Time Interval Example using CAST
- A Complex Time Interval Example using CAST
- The OVERLAPS Command
- An OVERLAPS Example that Returns No Rows
- The OVERLAPS Command using TIME
- OLAP Functions
- The Row_Number Command
- Using a Derived Table and Row_Number
- Ordered Analytics OVER
- RANK and DENSE RANK
- RANK Defaults to Ascending Order
- Getting RANK to Sort in DESC Order
- RANK() OVER and PARTITION BY
- PERCENT_RANK() OVER
- PERCENT_RANK() OVER with 14 rows in Calculation
- PERCENT_RANK() OVER with 21 rows in Calculation
- Finding Gaps Between Dates
- CSUM - Rows Unbounded Preceding Explained
- CSUM - Making Sense of the Data
- CSUM - Making Even More Sense of the Data
- CSUM - The Major and Minor Sort Key(s)
- The ANSI CSUM - Getting a Sequential Number
- Troubleshooting The ANSI OLAP on a GROUP BY
- Reset with a PARTITION BY Statement
- PARTITION BY only Resets a Single OLAP not ALL of them
- PARTITION BY only Resets a Single OLAP not ALL of them
- CURRENT ROW AND UNBOUNDED FOLLOWING
- Different Windowing Options
- Moving Sum has a Moving Window
- How ANSI Moving SUM Handles the Sort
- Moving SUM every 3-rows Vs a Continuous Average
- Partition By Resets an ANSI OLAP
- The Moving Window is Current Row and Preceding
- How Moving Average Handles the Sort
- Moving Average
- Moving Average every 3-rows Vs a Continuous Average
- Partition By Resets an ANSI OLAP
- Moving Difference using ANSI Syntax
- Moving Difference using ANSI Syntax with Partition By
- COUNT OVER for a Sequential Number
- COUNT OVER Without Rows Unbounded Preceding
- The MAX OVER Command
- MAX OVERwith PARTITION BY Reset
- MAX OVER Without Rows Unbounded Preceding
- The MIN OVER Command
- MIN OVER Without Rows Unbounded Preceding
- Finding a Value of a Column in the Next Row with MIN
- The CSUM For Each Product_Id and the Next Start Date
- How Ntile Works
- Ntile
- Ntile Continued
- Ntile Percentile
- Another Ntile Example
- Using Tertiles (Partitions of Four)
- NTILE
- NTILE Using a Value of 10
- NTILE With a Partition
- Using FIRST_VALUE
- FIRST_VALUE
- FIRST_VALUE After Sorting by the Highest Value
- FIRST_VALUE with Partitioning
- Using LAST_VALUE
- LAST_VALUE
- Using LAG and LEAD
- Using LEAD
- Using LEAD With and Offset of 2
- LEAD
- LEAD With Partitioning
- Using LAG
- Using LAG With an Offset of 2
- LAG
- LAG with Partitioning
- MEDIAN with Partitioning
- CUME_DIST
- CUME_DIST With a Partition
- SUM(SUM(n))
- Temporary Tables
- There are Three types of Temporary Tables
- CREATING A Derived Table
- Naming the Derived Table
- Aliasing the Column Names in The Derived Table
- Multiple Ways to Alias the Columns in a Derived Table
- CREATING A Derived Table using the WITH Command
- The Same Derived Query shown Three Different Ways
- Most Derived Tables Are Used To Join To Other Tables
- The Three Components of a Derived Table
- Visualize This Derived Table
- Our Join Example With A Different Column Aliasing Style
- Column Aliasing Can Default For Normal Columns
- Our Join Example With The WITH Syntax
- Clever Tricks on Aliasing Columns in a Derived Table
- A Derived Table lives only for the lifetime of a single query
- An Example of Two Derived Tables in a Single Query
- Example of Two Derived Tables in a Single WITH Statement
- Syntax for Temporary Tables
- Temporary Tables Explained
- Key Temporary Table Terms
- Creating and Populating a Local Temporary Table
- Using a Local Temporary Table
- Creating and Populating a Global Temporary Table
- Creating and Populating a Global Temporary Table
- Some Great Examples of Creating a Temporary Table Quickly
- Creating a Temporary Table That is Sorted
- A Temp Table That Populates Some of the Rows
- A Temporary Table With Some of the Columns
- Sub-query Functions
- An IN List is much like a Subquery
- An IN List Never has Duplicates - Just like a Subquery
- The Subquery
- The Three Steps of How a Basic Subquery Works
- These are Equivalent Queries
- The Final Answer Set from the Subquery
- Should you use a Subquery or a Join?
- The Basics of a Correlated Subquery
- The Top Query always runs first in a Correlated Subquery
- Correlated Subquery Example vs. a Join with a Derived Table
- How the Double Parameter Subquery Works
- More on how the Double Parameter Subquery Works
- How to handle a NOT IN with PotentialNULL Values
- IN is equivalent to =ANY
- Using a Correlated Exists
- How a Correlated Exists matches up
- The Correlated NOT Exists
- The Correlated NOT Exists Answer Set
- Substrings and Positioning Functions
- The LENGTH Command Counts Characters
- The LENGTH Command - Spaces can Count too
- The LENGTH Command and Char(20) Data
- LENGTH and CHARACTER_LENGTH Are Equivalent
- OCTET_LENGTH
- The TRIM Command trims both Leading and Trailing Spaces
- Trim Combined with the CHARACTERS Command
- How to TRIM only the Trailing Spaces
- A Visual of the TRIM Command Using Concatenation
- Trim and Trailing is Case Sensitive
- How to TRIM Trailing Letters
- The SUBSTRING Command
- SUBSTRING and SUBSTR are equal, but use different syntax
- How SUBSTRING Works with NO ENDING POSITION
- Using SUBSTRING to move Backwards
- How SUBSTRING Works with a Starting Position of -1
- How SUBSTRING Works with an Ending Position of 0
- An Example using SUBSTRING, TRIM andCHAR Together
- The POSITION Command finds a Letters Position
- Using the SUBSTRING to Find the Second Word On
- Concatenation
- Concatenation and SUBSTRING
- Four Concatenations Together
- Troubleshooting Concatenation
- Interrogating the Data
- The NULLIFZERO Command
- The NULLIFZERO vs. Zeroes
- The ZEROIFNULL Command
- The COALESCE Command
- The COALESCE Answer Set
- The COALESCE Command - Fill In the Answers
- The COALESCE Answer Set
- COALESCE is Equivalent to This CASE Statement
- Some Great CAST (Convert And STore) Examples
- Some Great CAST (Convert And Store) Examples
- A Rounding Example
- Some Great CAST (Convert And Store) Examples
- Using an ELSE in the Case Statement
- Using an ELSE as a Safety Net
- Rules For a Valued Case Statement
- Rules For a Searched Case Statement
- The Basics of the CASE Statements
- The Basics of the CASE Statement
- Valued Case Vs. A Searched Case
- When an ELSE is present in CASE Statement
- The CASE Challenge
- The CASE Challenge Answer
- Combining Searched Case and Valued Case
- A Trick for getting a Horizontal Case
- Nested Case
- Put a CASE in the ORDER BY
- View Functions
- The Fundamentals of Views
- Creating a Simple View to Restrict Sensitive Columns
- You SELECT From a View
- Creating a Simple View to Restrict Rows
- A View Provides Security for Columns and Rows
- Basic Rules for Views
- How to Modify a View
- An Exception to the ORDER BY Rule inside a View
- Views Are Sometimes CREATED for Formatting
- Creating a View to Join Tables Together
- How to Alias Columns in a View CREATE
- The Standard Way Most Aliasing is Done
- What Happens When Both Aliasing Options Are Present
- Resolving Aliasing Problems in a View CREATE
- Answer to Resolving Aliasing Problems in a View CREATE
- Aggregates on View Aggregates
- Altering A Table After a View Has Been Created
- A View that Errors After An ALTER
- Set Operators Functions
- Rules of Set Operators
- INTERSECT Explained Logically
- INTERSECT Explained Logically
- UNION Explained Logically
- UNION Explained Logically
- UNION ALL Explained Logically
- UNION ALL Explained Logically
- EXCEPT Explained Logically
- EXCEPT Explained Logically
- Minus Explained Logically
- Minus Explained Logically
- Testing Your Knowledge
- An Equal Amount of Columns in both SELECT List
- Columns in the SELECT list should be from the same Domain
- The Top Query handles all Aliases
- The Bottom Query does the ORDER BY (a Number)
- Great Trick:Place your Set Operator in a Derived Table
- UNION Vs UNION ALL
- Using UNION ALL and Literals
- A Great Example of how EXCEPT works
- USING Multiple SET Operators in a Single Request
- Changing the Order of Precedence with Parentheses
- Using UNION ALL for speed in Merging Data Sets
- Table Create and Data Types
- Distribution Strategy 1 - Segmented By Hash
- Distribution Strategy 2 - Unsegmented
- Sorting the Data in a Table CREATE Statement
- Even Distribution
- Uneven Distribution Where the Data is Non-Unique
- Matching Distribution Keys for Co-Location of Joins
- Big Table / Small Table Joins
- Fact and Dimension Table Distribution Key Designs
- Why a Sort Key Improves Performance
- Sort Keys Help Group By, Order By and Window Functions
- Syntax for Temporary Tables
- Temporary Tables Explained
- Key Temporary Table Terms
- Creating and Populating a Local Temporary Table
- Using a Local Temporary Table
- Creating and Populating a Global Temporary Table
- Creating and Populating a Global Temporary Table
- Some Great Examples of Creating a Temporary Table Quickly
- Creating a Temporary Table That is Sorted
- A Temp Table That Populates Some of the Rows
- A Temporary Table With Some of the Columns
- Data Manipulation Language (DML)
- INSERT Syntax # 1
- INSERT example with Syntax 1
- INSERT Syntax # 2
- INSERT example with Syntax 2
- INSERT/SELECT Command
- INSERT/SELECT example using All Columns (*)
- INSERT/SELECT example with Less Columns
- Two UPDATE Examples
- Subquery UPDATE Command Syntax
- example of Subquery UPDATE Command
- Join UPDATE Command Syntax
- example of an UPDATE Join Command
- Fast UPDATE
- Example of Subquery DELETE Command
- Statistical Aggregate Functions
- The Stats Table
- The STDDEV_POP Function
- A STDDEV_POP Example
- The STDDEV_SAMP Function
- A STDDEV_SAMP Example
- The VAR_POP Function
- A VAR_POP Example
- The VAR_SAMP Function
- A VAR_SAMP Example
- The VARIANCE Function
- A VARIANCE Example
- The CORR Function
- A CORR Example
- Another CORR Example so you can Compare
- The COVAR_POP Function
- A COVAR_POP Example
- Another COVAR_POP Example so you can Compare
- The COVAR_SAMP Function
- A COVAR_SAMP Example
- Another COVAR_SAMP Example so you can Compare
- The REGR_INTERCEPTFunction
- A REGR_INTERCEPTExample
- Another REGR_INTERCEPT Example so you can Compare
- The REGR_SLOPE Function
- A REGR_SLOPEExample
- Another REGR_SLOPEExample so you can Compare
- The REGR_AVGXFunction
- A REGR_AVGXExample
- Another REGR_AVGXExample so you can Compare
- The REGR_AVGYFunction
- A REGR_AVGYExample
- Another REGR_AVGYExample so you can Compare
- The REGR_COUNTFunction
- A REGR_COUNTExample
- The REGR_R2Function
- A REGR_R2Example
- The REGR_SXXFunction
- A REGR_SXXExample
- The REGR_SXYFunction
- A REGR_SXYExample
- The REGR_SYYFunction
- A REGR_SYYExample
- Using GROUP BY
Class Materials
Each student will receive a comprehensive set of materials, including course notes and all the class examples.