Teradata Introduction
Teradata Architecture
Teradata Components
A Teradata Database
Teradata Users
DATABASE Command
Use of an Index
Primary Index
Secondary Index
HELP commands
SHOW commands
EXPLAIN
Adding Comments
ANSI Comment
Teradata Comment
User Information Functions
ACCOUNT Function
DATABASE Function
SESSION Function
Data Conversions
Data Types
CAST
Implied CAST
Formatted Data
Tricking the ODBC to Allow Formatted Data
TITLE Attribute for Data Columns
Transaction Modes
Case Sensitivity of Data
CASESPECIFIC
LOWER Function
UPPER Function
V. Aggregation
Aggregate Processing
Math Aggregates
The SUM Function
The AVG Function
The MIN Function
The MAX Function
The COUNT Function
Aggregates and Derived Data
GROUP BY
Limiting Output Values Using HAVING
Statistical Aggregates
The KURTOSIS Function
The SKEW Function
The STDDEV_POP Function
The STDDEV_SAMP Function
The VAR_POP Function
The VAR_SAMP Function
The CORR Function
The COVAR Function
The REGR_INTERCEPT Function
The REGR_SLOPE Function
Using GROUP BY
Use of HAVING
Using the DISTINCT Function with Aggregates
Aggregates and Very Large Data Bases (VLDB)
Potential of Execution Error
GROUP BY versus DISTINCT
Performance Opportunities
Subquery
Using NOT IN
Using Quantifiers
Qualifying Table Names and Creating a Table Alias
Qualifying Column Names
Creating an Alias for a Table
Correlated Subquery Processing
EXISTS
Join Processing
Original Join Syntax
Product Join
Newer ANSI Join Syntax
INNER JOIN
OUTER JOIN
LEFT OUTER JOIN
RIGHT OUTER JOIN
FULL OUTER JOIN
CROSS JOIN
Self Join
Alternative JOIN / ON Coding
Adding Residual Conditions to a Join
INNER JOIN
OUTER JOIN
OUTER JOIN Hints
Parallel Join Processing
Join Index Processing
X. OLAP Functions
Data Maintenance
Considerations for Data Maintenance
Safeguards
INSERT Command
Using Null for DEFAULT VALUES
INSERT / SELECT Command
Fast Path INSERT / SELECT
UPDATE Command
Fast Path UPDATE
DELETE Command
Fast Path DELETE
UPSERT
ANSI Vs Teradata Transactions
Performance Issues With Data Maintenance
Impact of FALLBACK on Row Modification
Impact of PERMANENT JOURNAL Logging on Row Modification
Impact of Primary Index on Row Modification
Impact of Secondary Indices on Row Modification
Data Interrogation
NULLIFZERO
NULLIF
ZEROIFNULL
COALESCE
CASE
Flexible Comparisons within CASE
Comparison Operators within CASE
CASE for Horizontal Reporting
Nested CASE Expressions
CASE used with the other DML
Using CASE to avoid a join
Views
Reasons to Use Views
Considerations for Creating Views
Creating and Using VIEWS
Deleting Views
Modifying Views
Modifying Rows Using Views
DML Restrictions when using Views
INSERT using Views
UPDATE or DELETE using Views
WITH CHECK OPTION
Locking and Views
Macros
CREATE MACRO
REPLACE MACRO
EXECUTE MACRO
DROP MACRO
Generating SQL from a Macro
What is a Transaction
Locking
Transaction Modes
Comparison Chart
Setting the Transaction Mode
Teradata Mode Transactions
ANSI Mode Transactions
Aborting Teradata Transactions
Aborting ANSI Transactions
Creating Tables
Table Considerations
Maximum Columns per Table
Table Naming Conventions
CREATE TABLE
Column Data Types
Specifying the Database in a CREATE TABLE Statement
PRIMARY INDEX considerations
Table Type Specifications of SET VS MULTISET
SET and MULTISET Tables
Protection Features
FALLBACK
Permanent Journal
BEFORE Journal
AFTER Journal
Internal Storage Options
DATABLOCKSIZE
FREESPACE PERCENTAGE
Column Attributes
Constraints
UNIQUE Constraint
CHECK Constraint
Referential Integrity (RI) Constraint
Defining Constraints at the Column level
Defining Constraints at the Table Level
Utilizing Default Values for a Table
CREATE TABLE to Copy an existing table
Altering a Table
Dropping a Table
Dropping a Table versus Deleting Rows
Renaming a Table
Using Secondary Indices
Join Index
Collecting Statistics
Hashing Functions
HASHROW
HASHBUCKET
HASHAMP
HASHBAKAMP
Conclusion
Temporary Tables
Creating Interim or Temporal Tables
Temporary Table Choices
Derived Tables
Volatile Temporary Tables
Global Temporary Tables
GLOBAL Temporary Table Examples
General Practices for Temporary use Tables
Triggers
Terminology
Logic Flow
CREATE TRIGGER Syntax
Row Trigger
Statement Trigger
‘BEFORE’ Trigger
‘AFTER’ Trigger
‘INSTEAD OF’ Trigger
Cascading Triggers
Sequencing Triggers
TERADATA UTILITIES
I. INTRODUCTION
II. BTEQ
AN INTRODUCTION TO BTEQ
Why it is called BTEQ?
Logging on to BTEQ
USING BTEQ TO SUBMIT QUERIES
Submitting SQL in BTEQ’s Interactive Mode
Submitting SQL in BTEQ’s Batch Mode
USING BTEQ CONDITIONAL LOGIC
USING BTEQ TO EXPORT DATA
BTEQ EXPORT EXAMPLE USING RECORD (DATA) MODE
BTEQ EXPORT EXAMPLE USING FIELD (REPORT) MODE
BTEQ IMPORT EXAMPLE
DETERMINING OUT RECORD LENGTHS
BTEQ RETURN CODES
BTEQ COMMANDS
Session Control Commands
File Control Commands
Sequence Control Commands
Format Control Commands
III. FASTEXPORT
AN INTRODUCTION TO FASTEXPORT
Why it is called “FAST”Export
How FastExport Works
FastExport Fundamentals
FastExport Supported Operating Systems
Maximum of 15 Loads
FASTEXPORT SUPPORT AND TASK COMMANDS
Support Environment Commands (see Support Environment chapter for details)
Task Commands
FASTEXPORT SUPPORTED SQL COMMANDS
SQL Commands
A FASTEXPORT IN ITS SIMPLEST FORM
SAMPLE FASTEXPORT SCRIPT
FASTEXPORT MODES AND FORMATS
FastExport Modes
FastExport Formats
A FASTEXPORT SCRIPT USING BINARY MODE
IV. FASTLOAD
AN INTRODUCTION TO FASTLOAD
Why it is called “FAST”Load
How FastLoad Works
FastLoad Has Some Limits
Three Key Requirements for FastLoad to Run
Maximum of 15 Loads
FASTLOAD HAS TWO PHASES
PHASE 1: Acquisition
PHASE 2: Application
FASTLOAD COMMANDS
A FASTLOAD EXAMPLE IN ITS SIMPLEST FORM
SAMPLE FASTLOAD SCRIPT
CONVERTING DATA TYPES WITH FASTLOAD
A FASTLOAD CONVERSION EXAMPLE
WHEN YOU CANNOT RESTART FASTLOAD
WHEN YOU CAN RESTART FASTLOAD
WHAT HAPPENS WHEN FASTLOAD FINISHES
RESTARTING FASTLOAD: A MORE IN-DEPTH LOOK
How the CHECKPOINT Option Works
Restarting with CHECKPOINT
Restarting without CHECKPOINT — Preferred Method
USING INMODS WITH FASTLOAD
V. MULTILOAD
VI. TPUMP
AN INTRODUCTION TO TPUMP
Why It Is Called “TPump”
TPump Has Many Unbelievable Abilities
TPump Has Some Limits
Supported Input Formats
TPUMP COMMANDS AND PARAMETERS
LOAD Parameters IN COMMON with MultiLoad
.BEGIN LOAD Parameters UNIQUE to TPump
A SIMPLE TPUMP SCRIPT — A LOOK AT THE BASICS
TPUMP SCRIPT WITH ERROR TREATMENT OPTIONS
TPUMP OUTPUT STATISTICS
A TPUMP SCRIPT THAT USES TWO INPUT DATA FILES
A TPUMP UPSERT SAMPLE SCRIPT
MONITORING TPUMP
HANDLING ERRORS IN TPUMP USING THE ERROR TABLE
One Error Table
Common Error Codes and What They Mean
RESTARTING TPUMP
TPUMP AND MULTILOAD COMPARISION CHART
WHAT IS OF AN INMOD
HOW AN INMOD WORKS
CALLING AN INMOD FROM FASTLOAD
WRITING AN INMOD
Writing for Fastload
Writing for MultiLoad, TPump and FastExport
MIGRATING AN INMOD
WRITING A NOTIFY ROUTINE
SAMPLE INMOD
WHAT IS OF AN OUTMOD
HOW AN OUTMOD WORKS
CALLING AN OUTMOD FROM FASTEXPORT
WRITING AN OUTMOD
WRITING A NOTIFY ROUTINE
SAMPLE OUTMOD
IX. SUPPORT ENVIRONMENT