Professional Documents
Culture Documents
Data Marts
2
2
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
3
3
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
4
4
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
the
5
5
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
6
6
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
7
7
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Pictorial Representation:
OPERATIONAL DATA STORE
DATAWARE
HOUSE
INDEPENDEN
T DATA MART
LOGICAL
DATA MART
DEPENDENT
DATA MART
8
8
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
DEPENDEN
T DATA
MART
9
9
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Features of CRM:
10
10
Campaign Management
Marketing Resource Management
Offer Management
Active Analytics
Integrated Web Intelligence
Interaction Management
Communication Management
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Teradata Database
What is Teradata Database ?
11
TeraData
12
open
system,
TeraData
TeraData Database is an ideal foundation for many applications
like,
Enterprise Data warehousing
Active Data warehousing
CRM
E-Businesses
Data Marts
13
TeraData
What makes TeraData DB Unique ?
14
Scalability
15
TeraData - Scalability
16
Teradata Unconditional
Parallelism
Teradata Database more faster
than a non-parallel system.
Multi processor work together to
process a task quickly.
The Teradata Database's
parallelism does not depend on
limited data quantity, column
range constraints, or specialized
data models -- The Teradata
Database has "unconditional
parallelism."
17
18
19
Teradata - Architecture
Figure shows the typical
architecture of the Teradata
database.
Main Components of
Teradata Database are,
1] Parsing Engine (PE)
2] Banyan Network (BYNET)
3] Access Module Process
(AMP)
4] Disk (Storage)
20
21
22
23
24
25
26
Teradata
Cliques
The clique is a feature of multinode systems that physically
groups nodes together by multi ported access to common disk
array units.
Figure illustrates the four node Clique
27
DATA PROTECTION
Journaling:
28
28
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
29
29
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Transient Journel:
Logs BEFORE images for transactions
Is used by system to roll back failed transactions aborted
either by the user or by the system Captures:
Begin/End Transaction indicators
"Before" row images for UPDATE and DELETE statements
Row IDs for INSERT statements
Control records for CREATE, DROP, DELETE, and ALTER
statements
Keeps each image on the same AMP as the row it describes
Discards images when the transaction or rollback Completes
Occurs always
30
30
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Permanent Journel:
Is available for tables or databases
Can contain "before" images, which permit rollback,
or after images, which permit roll-forward, or both
before and after images
Provides roll-forward recovery
Provides rollback recovery
Provides full recovery of non-fallback tables
Reduces need for frequent, full-table archives
Occurs as specified by the user.
31
31
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
RAID
Redundant Array of Independent Disks (RAID)
RAID-1
RAID-5
32
32
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
RAID-1:
RAID-1 is the most common level.
Also called MIRRORING.
With RAID-1, each primary disk has a mirror image,
an exact copy of all its data on another disk. The
contents of both disks are identical.
33
33
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
or
RAID-5:
RAID 5 protection protects data from being lost because of
a disk unit failure or because of damage to a disk.
RAID
5 protection protects against a one disk unit failure.
RAID5 protects data from single-disk failures with a 25
percent increase in disk storage to provide parity.
34
34
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Disadvantages of RAID:
RAID1 provides better performance and data protection
than RAID5, but is more expensive.
Even though RAID disk array technology may provide
access
to data even when you have not specified
fallback,
neither RAID-1 nor RAID-5 provides the same level of
protection as fallback does.
Backups need to be done with arcmain for best dataprotection.
35
35
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Fallback:
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
37
37
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
38
39
40
41
Easier to program.
42
Teradata Components
1.
2.
3.
4.
5.
6.
7.
8.
43
BTEQ
CLI
Fast Load
Multi Load
Fast Export
Tpump
Teradata Parallel Transporter (TPT)
Teradata Manager
Teradata BTEQ
.
44
45
45
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Log off
The LOGOFF command ends the current RDBMS sessions without exiting BTEQ. If
you execute a LOGOFF command while a transaction is in progress, BTEQ aborts
the transaction and backs out any changes that had been made to the database.
Syntax :
.logoff
Exit
Immediately end the current session or sessions and exit BTEQ.
Syntax :
.exit
46
46
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Interactive mode :
Start a BTEQ session, and submit commands to the database as needed.
Batch mode :
Prepare scripts or macros, and then submit them to BTEQ for processing.
47
47
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
48
48
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Changing Database
In Teradata user itself is database. As a user you will have access to your
own user database and its objects.
The user name you used to logon with is usually your default database.
49
49
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
50
50
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
51
51
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
52
52
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
53
53
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
54
54
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Data Source
ODBC Driver
Starting Teradata SQL Assistant
Connecting to and Disconnecting from a Data Source
Changing the Database Password
ODBC Driver
Before using Teradata SQL Assistant to access the data in your RDBMS, you
must first install an ODBC driver.
Each RDBMS requires a driver that is designed specifically for that database
system.
55
55
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
57
57
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Main Window
The Teradata SQL Assistant main window appears with a blank Query
window on the top and a History window on the bottom.
58
58
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Windows
Query Window
The Query window is where you enter and execute a query. The results from your
query are placed into one or more Answerset windows. Alternatively, the results
may be written directly to a file.
To display the Query Window Shortcut Menu
Do one of the following:
From the Query window, click the right mouse button.
Press Shift-F10.
Press Context Menu on your keyboard.
59
59
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Answerset window
The Answerset window is a table that displays the results from a statement. You can
sort the output in a number of ways and print as bitmaps in spreadsheet format.
Individual cells, rows, columns, or blocks of columns may be formatted to change the
background and foreground color as well as the font style, name, and size. You can
make other modifications such as displaying or hiding gridlines and column headers.
To display the Answerset Window Shortcut Menu
60
60
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
History window
The History window is a table that displays your past queries and related processing
attributes. The past queries and processing attributes are stored locally in a Microsoft
Access 95 or 2000 database. This allows the flexibility to work with previous SQL
statements in the future.
To display the History Window Shortcut Menu
Do one of the following:
Click the right mouse button anywhere within the History window,
Press Shift-F10 or the Context Menu Key
61
61
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Teradata CLI
Teradata Call-Level Interface is a collection of callable service
routines that provide the interface between applications and
the Teradata Gateway. Gateway is the interface between CLI
and the Teradata Database
62
63
65
66
67
Limitations
MultiLoad doesnt support the following conditions.
Concatenation of data files
Aggregate operators,exponential operators,arithmetic
functions
Data retrieval from the Teradata Database with the
SELECT
statements
Foreign key references
Unique secondary indexes
Maximum number of columns is limited to 2048
68
Teradata Tpump
Tpump Continuous Data Loading
Teradata TPump is a highly parallel utility designed to
continuously move data from data sources into Teradata tables
without locking the affected table
TPump provides near-real-time data into your data warehouse,
allowing you to maintain fresh,accurate data for up-to-themoment decision making
Tpump is used to insert, update, upsert, and delete data
in the Teradata Database, particularly forenvironments where
batch windows are shrinking and warehouse maintenance
overlaps normal working hours
69
71
72
73
Access Considerations
When choosing the primary index for a table, there are two essential
factors to keep in mind:
uniform distribution of the data
optimal access
74
Access Considerations
For example:
If rows are generally accessed by a range query, consider defining a PPI on
the table that creates a useful set of partitions.
If the table is frequently joined with a specific set of tables, consider
defining the primary index on the column set that is typically used as the
join condition.
Primary index operations must provide the full primary index value.
Primary index retrievals on a single value are always one-AMP operations
75
Additional Indexes
Primary index
76
Secondary index
Hash index
Primary indexes
All Teradata Database tables require a primary index because the system
distributes tables on their primary indexes.
It helps for the uniform data distribution
Primary indexes can be:
Unique or Non-unique
Partitioned or Non-partitioned
77
Secondary index
It helps for the efficient data access
Secondary indexes can be
Unique or Non-unique.
78
Unique index
Unique index
A unique index, has a unique value for each row in a table.
Teradata Database defines two different types of unique index.
Unique primary index (UPI)
UPIs provide optimal data distribution and are typically assigned to the
primary key for a table.
Unique secondary index (USI)
USIs guarantee that each complete index value is unique, while ensuring
that data access based on it is always a two-AMP operation
79
Non-Unique index
Non-Unique index:
A non-unique index does not require its values to be unique
80
81
This is the traditional primary index by which rows are assigned to AMPs.
82
Join Indexes
Join Indexes
A join index is an indexing structure containing columns from one or more
base tables and is generally used to resolve queries and eliminate the need to
access and join the base tables it represents.
83
Hash Indexes
84
Hash indexes are used for the same purposes as are single-table join
indexes.
85
Qualify
Delete Command
Additional Features
Qualify
Sometimes when you are working with SQL you may need an extra row or
two. Oracle has its infamous DUAL table that could be used for that:
Teradata exhibits similar behavior without table name
86
Table Creation
When creating tables. we have format and default clauses specified in this
table definition. DEFAULT is a standard clause and does what you would
expect. The FORMAT only works when one uses Teradata BTEQ tool as
opposed to a Teradata SQL Assistant.
87
Delete Command
In Oracle, Syntax for Deleting Table
DELETE from table_name;
88
Additional Features
Additional Features:
SHOW Command :
Gives definition(DDL) of the database object.
HELP Command :
Gives the contents of the database object.
MACRO :
Package of pre-written, frequently run SQL statements.
Helpful for reusable queries
89
Macros
90
91
CREATE Macro
EXEC Macro
SHOW Macro
REPLACE Macro
DROP Macro
EXPLAIN Macro
Create a Macro:
92
92
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Execute a Macro:
You can use Execute command to Insert data into table.
Delete a
Macro:
DROP MACRO Macro name;
93
93
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Parameterized Macro
Example:
Create Macro Dept_list(dept int) AS
(Select last_name from employee
where department_number=:dept);
Exec Dept_list(301);
94
Example
Create Macro emp_check(dept integer, sal_amount
dec(9,2) AS (select emp_number from employee where
depart_number=:dept and sal_amount <:sal_amount);
Exec emp_check(201,5000);
95
HELP SESSION:
This command is used to display the user name, account name, logon
date and time, current database name, collation code set and character set
being used and also , transaction semantics, time zone and character set
data.
96
96
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
97
97
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
HELP STATISTICS
<table-name> ;
This command is used to display values associated with the data demographics collected on the
table. This information is used by the Optimizer to create a plan for SQL.
HELP CONSTRAINT
<table-name>.<constraint-name> ;
This command is used to display the checks to be made on the data when it is inserted or updated
and the columns are involved.
HELP 'SQL';
This command is used to display a list of all available SQL commands and functions.
98
98
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
HELP 'SPL';
This command is used to display the basic syntax and options for the
SPL command used in place of the <command>.
99
99
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
100
100
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
SHOW ERRORMAP
Purpose
Displays the contents of the tables that map error codes to severity levels.
Uses
We can use SHOW ERRORMAP command when you want to display the return code associated
with a specific error.
SHOW VERSIONS
Purpose
Returns the current level of each BTEQ software
Uses
We can use the SHOW VERSIONS command to determine which version of
BTEQ is running.
We can use the SHOW VERSIONS command in a Teradata SQL macro.
.
101
101
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
102
Tenacity
Tenacity:
Purpose
The TENACITY command specifies the number of hours that
Teradata Fastload continues trying to log on when the
maximum number of load operations is already running on
the Teradata Database.
Syntax:
TENACITY hours
Syntax Element hours: Number of hours that Teradata
Fastload continues trying to log on.
The hours specification must be greater than zero. If you
enter zero, Teradata
Fastload responds with an error message and terminates.
103
Checkpoints
104
105
Collecting Statistics
This facilitates the periodic updation of Data Dictionary with
the recent information's about the Database Objects.
The Syntax is:
COLLECT STATISTICS/
COLLECT STATS/
COLLECT STAT
106
EXPLAIN Facility
107
Rank Function
Returns an ordered ranking of rows based on the
value_expression in the ORDER BY clause.
Syntax
109
Rank Function
This example ranks salespersons by sales region based on their
sales.
SELECT sales_person, sales_region, sales_amount,RANK() OVER
(PARTITION BY sales_region ORDER BY sales_amount DESC)
FROM sales_table;
110
Salary
46000
-----46000
60000
65000
------125000
55000
------55000
62000
65000
------127000
72000
------72000
------425000
Sample Function
Sample function is used to randomly display the records from the table.
Sql Syntax:
select * from tablename sample n
n represents the number of records to be displayed or also could be
percentage of the records to be displayed
Example
Select * from emp sample 2 This will display 2 records
112
113
113
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
114
114
Byte
Numeric
Date
Character
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
115
115
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
116
116
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Expression
an expression with known data type to be cast as a different data
type.
ansi_sql_data_type
the new data type for expression.
data_type_list
the new data type or data attributes or both for expression.
117
117
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
118
118
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Expression
The data expression to be converted to the new definition defined by data_type_list
Data_type_list
A data type declaration or data attributes or both.List elements must be separated
by commas.
119
119
2010
Wipro
Confidential
2009
2009 Wipro
WiproLtd
Ltd
-
Confidential
- 2010
Confidential
Wipro Ltd
Ltd -- Confidential
Thank You
120
4/29/15
2008
Wipro
- - Confidential
2009
Wipro Ltd
-
Confidential
2010Ltd
Wipro Ltd
Confidential
120