0% found this document useful (0 votes)
14 views

Teradata Advanced SQL

Uploaded by

charbel marun
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Teradata Advanced SQL

Uploaded by

charbel marun
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

TERADATA

ADVANCED
INSTRUCTOR-LED TRAINING COURSE SQL

TERADATA ADVANCED SQL


Lecture/Lab

ILT 25966 4 Days

COURSE DESCRIPTION COURSE OBJECTIVES


Designed for senior programmers and data analysts, this After successfully completing this course, you will be able
course focuses on advanced and analytic SQL features and to:
techniques. Extensive hands-on labs help reinforce
learning. ~ Use various forms of derived, volatile and global
temporary tables
~ Work with the Window Aggregate and Extended
AUDIENCE Grouping functions
~ Application Developers ~ Use the ANSI Merge syntax to merge data from source
~ Data Analysts to target
~ Database Administrators ~ Write SQL using the RANK, QUANTILE and
~ Architects/Designers WIDTH_BUCKET analytic functions
~ Work with advanced features, such as recursive
subqueries, scalar subqueries, and interval data types
PREREQUISITES ~ Understand and use Date, Time and Timestamp
To get the most out of this training, you should have the
following knowledge or experience.
~ Introduction to Teradata Database
(ILT #25964 or WBT #26438)
~ Teradata SQL
(Instructor-led (#25965) or WBT (#54458))

COURSE OUTLINE*
DAY 1 DAY 2 DAY 3 DAY 4
~ Introduction ~ Window Aggregates ~ Scalar Subqueries ~ Timestamps and
~ Creating Tables from ~ Rank ~ Recursive Queries Timezones
Existing Tables ~ Extended Grouping ~ Date-Time Data Types ~ Advanced Date and
~ Global Temporary Functions ~ Interval Data Types and Time Formatting
Tables ~ QUANTILE and Manipulations ~ Other Formatting
~ Window Aggregates WIDTH_BUCKET Options
~ Correlated Subqueries ~ SQL Functions

* Timing and topics covered by day may vary

Updated: 29/Nov/18 1 of 5
Version: 16.20.0
TERADATA
ADVANCED
SQL
COURSE CONTENT

Module 0 – Introduction
~ Recommended Prerequisite Knowledge Module 3 - Global Temporary Tables
~ Course Objectives ~ What Are They?
~ Course Modules ~ Creating Global Temporary Tables
~ Materializing Global Temporary Tables
Module 1 - Creating Tables from Existing Tables ~ Space Allocation
~ SQL Assistant Cloned Table ~ Getting HELP Table Manipulations
~ Create Table AS ~ Secondary Indexes on Base Tables
~ Cloning Attributes ~ Secondary Indexes on Instances
~ Changing Table Attributes ~ Dropping Indexes on Base Tables
~ Using Subqueries to Customize Tables ~ Dropping Indexes on Instances
~ Renaming Columns ~ Collecting Statistics on Base Tables
~ Changing Column Attributes ~ Collecting Statistics on Instances
~ Using Inner Joins in a Subquery ~ Dropping Statistics on Base Tables
~ Using Other Joins in a Subquery ~ Dropping Statistics on Instances
~ Using Expressions for Columns ~ Using CREATE TABLE AS
~ Using CAST ~ Summary
~ Aliases Having Non-Standard Characters ~ Review Questions
~ Adding Unique and Primary Key Constraints ~ Lab Exercises
~ Adding Default Values
~ Populating Default Column Values Module 4 - Window Aggregates - Part 1
~ Copying Statistics ~ Window Aggregate Functions
~ Summary ~ The GROUP COUNT Window
~ Review Questions ~ Relating the Result to the Syntax
~ Lab Exercises ~ GROUP COUNT and Null
~ GROUP COUNT(*)
Module 2 - Derived and Volatile Tables ~ Group SUM and AVG Window
~ Permanent Tables for Ad Hoc Queries ~ Group MIN and MAX Window
~ Pros and Cons for Ad Hoc Perm Tables ~ Group AVG and QUALIFY
~ Temporary Table Choices ~ Qualifying a Non-Projected Column
~ Derived Tables ~ GROUP COUNT and PARTITION
~ “WITH” Derived Table Syntax Form ~ GROUP COUNT, PARTITION, and Null
~ Derived Tables and Joins ~ GROUP COUNT and Null Partitions
~ Multiple “WITH” Derived Table Syntax Form ~ GROUP SUM and Partition
~ CREATE TABLE AS and Derived Tables ~ GROUP SUM and Reordering
~ Volatile Table Syntax ~ GROUP SUM Reorder Explanation
~ Pros and Cons of Volatile Tables ~ SQL ORDER BY to Preserve Order
~ Volatile Table Restrictions ~ Window ORDER BY to Preserve Order
~ HELP and SHOW (Volatile) TABLE ~ Qualifying on a Windowed Non-Aggregated
~ ON COMMIT DELETE ROWS ~ Multiple Column Partitions
~ Implicit Transactions ~ Partitioning on Literals
~ Explicit Transactions ~ WHERE vs. QUALIFY
~ ON COMMIT PRESERVE ROWS ~ Order of Group SUM and Aggregation
~ Limitations ~ Projecting Multiple Window Aggregates
~ Volatile Tables from Derived Tables ~ Summary
~ Use with Views and Macros ~ Review Questions
~ Another View and Macro Strategy ~ Lab Exercises
~ Volatile Table Quiz
~ Summary
~ Review Questions
~ Lab Exercises

Updated: 29/Nov/18 2 of 5
Version: 16.20.0
TERADATA
ADVANCED
SQL

Module 5 - Window Aggregates - Part 2 ~ Lab Exercises


~ What’s in this Module?
~ What’s ANSI Standard and What’s Not? Module 7 - Extended Grouping Functions
~ Cumulative Sum ~ Extended Grouping Functions Overview
~ Cumulative Sum with Partitioning ~ Aggregation Review
~ Cumulative MIN ~ ROLLUP
~ Cumulative Count ~ Two-Level Rollup
~ Moving Sum ~ Switching Rollup Column Order
~ Moving AVG – Not in Range ~ Other than Sums
~ Moving Difference ~ Using Positional References
~ Moving Difference and QUALIFY ~ Three-Level Rollup
~ MDIFF ~ Null Group vs. Total
~ Moving Difference and Partition ~ The GROUPING Function
~ Remaining Window ~ Two-Columns into One Level
~ Remaining Window and Partition ~ CUBE vs. ROLLUP
~ Moving Window and Following ~ CUBE Result
~ RESET WHEN ~ CUBE and GROUPING Function
~ PRECEDING vs. FOLLOWING ~ Three-Level Cube
~ PRECEDING Using “0” and CURRENT ~ Combining Groupings in a Cube
~ FOLLOWING Using “0” and CURRENT ~ Combining Groupings in a Rollup
~ Summary ~ Aggregating Outside a Rollup
~ Review Questions ~ The GROUPING SETS Function
~ Lab Exercises ~ Adding Grand Totals
~ Combining Grouping Sets
Module 6 - RANK ~ Different Method for Same Result
~ Ranking Values ~ Grouping Sets for Cubes
~ QUALIFY with No Tied Values ~ GROUPING SETS within a Group
~ QUALIFY with Tied Ending Values ~ The Multiplier Effect
~ Qualifying Without Rank Projection ~ Multiple Grouping Sets
~ Bottom Values by ASC Rank ~ Three Approaches
~ Bottom Values by DESC Rank ~ Unnecessary Methods
~ RANK and PARTITION ~ Summary
~ Group Sum on Partitioned Rank ~ Review Questions
~ ROW_NUMBER ~ Lab Exercises
~ ROW_NUMBER vs. RANK
~ ROW_NUMBER and PARTITION Module 8 - QUANTILE and WIDTH_BUCKET
~ ROW_NUMBER and RESET WHEN ~ QUANTILE Overview
~ TD14.10 RANK Functionality ~ QUANTILE and QUALIFY
~ RANK Examples ~ QUANTILE with no Projected Value
~ PERCENT_RANK ~ Aggregation and QUANTILE
~ TD14.10 PERCENTILE_CONT ~ OLAP vs. Window Aggregates
~ TD14.10 PERCENTILE_DISC ~ QUANTILE and GROUP BY
~ TD14.10 MEDIAN ~ Varying a QUANTILE
~ TD14.10 CUME_DIST ~ Ordering a QUANTILE
~ TD14.10 CUME_DIST Result ~ PERCENT_RANK vs. Percentile
~ TD14.10 FIRST_VALUE and LAST_VALUE ~ WIDTH_BUCKET
~ FIRST_VALUE and RESPECT NULLS ~ WIDTH_BUCKET and Histograms
~ RESPECT NULLS vs. IGNORE NULLS ~ Summary
~ Summary ~ Review Questions
~ Review Questions ~ Lab Exercises

Updated: 29/Nov/18 3 of 5
Version: 16.20.0
TERADATA
ADVANCED
SQL

Module 9 - Correlated Subqueries ~ Lab Exercises


~ Subquery Review
~ Correlated Subquery Terminology Module 12 - Date-Time Data Types
~ Correlated Subquery Processing ~ Default Date Formatting
~ Correlated Subqueries and Aggregation ~ Setting Date Formatting Defaults
~ A Complex Example ~ Session-Level Formatting
~ NOT IN vs. NOT EXISTS ~ ODBC Considerations
~ NOT IN Review ~ Integer Date and Default Formatting
~ NOT EXISTS vs. NOT IN Logic ~ ANSI Date and Default Formatting
~ Multiple Correlations ~ Using FORMAT
~ Summary ~ Using an Explicit Format
~ Review Questions ~ The “Century-Break” Setting
~ Lab Exercises ~ INTEGERDATE Century Break Examples
~ ANSIDATE Century Break Examples
Module 10 - Scalar Subqueries ~ ANSI Time
~ Subqueries ~ Inserting Unformatted Time Literals
~ Left-Side of Operator ~ ANSI Timestamp
~ CSSQ in a Projection ~ Setting Time Zone Defaults
~ NCSSQ and IN-List Processing ~ Extracting Information from Timestamps
~ CSSQ that Returns No Rows ~ Summary
~ NCSSQ and CASE ~ Review Questions
~ NCSSQ and Arithmetic Expressions ~ Lab Exercises
~ CSSQ and Update
~ Summary Module 13 - Interval Data Types and Manipulations
~ Review Questions ~ Interval Data Types
~ Lab Exercises ~ Year-Month – Day-Time Intervals
~ Interval Data Types and Date Arithmetic
Module 11 - Recursive Queries ~ Date Literals and Intervals
~ Recursive Query Description ~ Interval Calculations
~ Building Tables for Recursive Processing ~ Complex Interval Calculations
~ Creating a “One Stopover” Table ~ Deriving Days between Dates
~ Querying Two Levels of Recursion ~ Deriving Intervals between Dates
~ Creating a “Two-Stopover” Table ~ Deriving Years between Dates
~ Querying Three Levels of Recursion ~ Interval-to-Interval Conversions
~ Recursive Query Logic ~ Extracting from Date Expressions
~ Recursive Query Example ~ Simple Day-Time Intervals
~ Analyzing the Depth ~ Complex Day-Time Intervals
~ Two-City Recursion ~ Combining Day-Time Intervals
~ Fixing a Two-City Chain Recursion ~ Interval and Time Literals
~ Greater Than Two-City Recursion ~ Time Subtraction
~ Fixing a Greater Than Two-City Recursion ~ Day-Time Interval Castings
~ Creating Recursive Views ~ More Interval Castings
~ Using Recursive Views ~ Interval Calculations
~ A Problem with This View? ~ Extracting from Time Expressions
~ Recursive Queries and Parameterized Macros ~ Summary
~ WITH Derived Table Usage ~ Review Questions
~ Non-Recursive WITH ~ Lab Exercises
~ Cross Referencing Multiple WITH Lists
~ Limitations and Restrictions
~ Summary
~ Review Questions

Updated: 29/Nov/18 4 of 5
Version: 16.20.0
TERADATA
ADVANCED
SQL

Module 14 - Timestamps and Time zones ~ Floating Currency Symbols – Local


~ Timestamp Review ~ ISO Currency Abbreviations
~ Time and Timestamp Literals ~ Currency Names
~ Timestamp-Interval Arithmetic ~ Signed Amounts
~ Timestamp Subtraction ~ Summary
~ Timestamp Castings ~ Review Questions
~ Time Zones ~ Lab Exercise
~ Data Types with Time Zones
~ A Tale of Three Cities Module 17 - SQL Functions
~ Los Angeles Adds a Row ~ Module Description
~ Normalizing Timestamps ~ LAST_DAY
~ Hong Kong Adds a Row ~ NEXT_DAY
~ The View from L.A. ~ TRUNC
~ The View from London ~ Using TRUNC with Dates
~ Extracting from Timestamp Expressions ~ ROUND
~ OVERLAPS Function ~ Using ROUND with Dates
~ Overlapping Data Type Options ~ REGEXP_SUBSTR
~ Summary ~ REGEXP_REPLACE
~ Review Questions ~ REGEXP_INSTR
~ Lab Exercises ~ REGEXP_SIMILAR
~ LTRIM
Module 15 - Advanced Date and Time Formatting ~ RTRIM
~ Year, Month, Day Options ~ LPAD
~ Day of Week Options ~ RPAD
~ Hours, Minutes, and Seconds Options ~ NGRAM
~ The 12-Hour Clock (AM-PM) ~ NVP
~ Time Precision Formatting ~ OREPLACE
~ Time Zone Placement ~ OTRANSLATE
~ Timestamp Formatting ~ INITCAP
~ Formatting and Qualification ~ INSTR
~ Getting Dates from Strings ~ NVL
~ LIKE and Formatting ~ CEILING and FLOOR
~ ODBC and JDBC Methods for FORMAT ~ DECODE
~ Summary ~ GREATEST
~ Review Questions ~ LEAST
~ Lab Exercises ~ TO_NUMBER
~ TO_CHAR
Module 16 - Other Formatting Options ~ TO_CHAR (DateTime)
~ FORMAT
~ TO_CHAR (DateTime Example)
~ Basic Formatting Options
~ TO_DATE
~ Basic Numeric Formats
~ TO_TIMESTAMP
~ Character Formats
~ Other Conversion Functions
~ Group Separator and Radix
~ LEAD and LAG Ordered Analytic Functions
~ Decimal Fractions and Zero Suppress
~ Summary
~ Fixed Currency Symbol – Local
~ Review Questions
~ Dual Currency Symbol – Local
~ Lab Exercises

Updated: 29/Nov/18 5 of 5
Version: 16.20.0

You might also like