of 40
7/27/2019 B402 DD
1/40
Module 2: The Data Dictionary/Directory
After completing this module, you will be able to:
Summarize information contained in the Data Dictionary/Directory tables.
Differentiate between restricted and unrestricted views.
Use the supplied Data Dictionary/Directory views to retrieveinformation about created objects.
7/27/2019 B402 DD
2/40
Data Dictionary / Directory
DBC
Sys_Calendar SysAdmin SystemFECrashdumps SYSDBA
Data Dictionary / Directory Tables
Object definitionsSystem event logsSystem message tableJournals and Restart control tablesAccounting information
Access control tables
Views of DD/D Tables
AdministrativeSecuritySupervisoryEnd UserOperational
Macros
Add calculation sequenceGenerate utilization reportsReset accounting valuesAuthorize secured functions
7/27/2019 B402 DD
3/40
Fallback Protected DD/D Tables
AccessRightsUsers Rights on objects
AccLogRuleTblSpecifies events to be logged
AccLogTblLogged User-Object events
AccountsAccount Codes by user
ALL(Dummy ) Represents al l tables
ConstraintNames DBaseDatabase and User Profiles
DBCInfoTblSoftware Release & Version
DatabaseSpaceStores disk usage information
IndexesDefines indexes on tables
OwnersHierarchy (Downward)
RCEventArchive/Recovery events
SW_Event_LogDatabase Console Log
TableConstraints
Table Constraints
ErrorMsgsMessage Codes and text
LogonRuleTblUsers Rights on objects
ParentsHierarchy (Upward)
RCMediaVolume/Serial # - ARC facility
RolesDefined Roles
SysSecDefaultsLogon security options
TempTables
Materialized Temporary Tables
EventLogSession logon/logoff history
NextInternal ID for next create
ProfilesUsers and logon attributes
ResUsageResource Usage tables
RoleGrantsUsers/Roles assigned to Roles
TVFieldsTable/View column description
Translation
National Character Support
HostsTo override default char. sets
OldPasswordsEncoded password history
RCConfigurationArchive/Recovery Config
ReferencedTblsReferential Integrity (PK)
SessionTblCurrent logon information
TVMTables, Views and Macros
TriggersTbl
Stores trigger information
ReferencingTblsReferential Integrity (FK)
(Partial list of Data Dictionary tables in V2R5)
7/27/2019 B402 DD
4/40
Non-Hashed Data Dictionary Tables
AcctgResource usage by user/account
ChangedRowJournalDown-AMP Recovery Journal
DatabaseSpaceDatabase and Table space accounting
LocalSessionStatusLast request status by AMP
LocalTransactionStatusLast TXN Consensus status
OrdSysChngTableTable-level recovery
RecoveryLockTableRecovery session locks
RecoveryPJTablePermanent Journal recovery
SavedTransactionStatusAMP recovery table
SysRcvStatJournalRecovery, reconfig, startup information
TransientJournalBack out uncommitted transactions
UtilityLockJournalTableHost Utility Lock records
AMP AMP AMP AMP
Virtual AMP Cluster
PRIMARY ROW FALLBACK ROW
AMP LOCAL ROW AMP LOCAL ROW AMP LOCAL ROW AMP LOCAL ROW
7/27/2019 B402 DD
5/40
Updating Data Dictionary Tables
EXPLAIN CREATE TABLE Orders
( order_id INTEGER NOT NULL, order_date DATE FORMAT 'yyyy-mm-dd', cust_id INTEGER )
UNIQUE PRIMARY INDEX (order_id);--------------------------------------------------------------------------------------------------------------------------------------------------1) First, we lock TFACT.Orders for exclusive use.2) Next, we lock a distinct DBC."pseudo table" for write on a RowHash for deadlock prevention, we
lock a distinct DBC."pseudo table" for write on a RowHash for deadlock prevention, we lock adistinct DBC."pseudo table" for read on a RowHash for deadlock prevention, and we lock a distinctDBC."pseudo table" for write on a RowHash for deadlock prevention.
3) We lock DBC.AccessRights for write on a RowHash, we lock DBC.TVFields for write on a RowHash,we lock DBC.TVM for write on a RowHash, we lock DBC.DBase for read on a RowHash, and we lockDBC.Indexes for write on a RowHash.
4) We execute the following steps in parallel.1) We do a single-AMP ABORT test from DBC.DBase by way of the unique primary index.2) We do a single-AMP ABORT test from DBC.TVM by way of the unique primary index with no
residual conditions.3) We do an INSERT into DBC.TVFields (no lock required).4) We do an INSERT into DBC.TVFields (no lock required).5) We do an INSERT into DBC.TVFields (no lock required).6) We do an INSERT into DBC.Indexes (no lock required).7) We do an INSERT into DBC.TVM (no lock required).8) We INSERT default rights to DBC.AccessRights for TFACT.Orders.
5) We create the table header.6) Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request.-> No rows are returned to the user as the result of statement 1.
7/27/2019 B402 DD
6/40
System Views
Clarify tables Re-title tables and/or columns. Reorder and format columns. Compute (derive) new column data.
Simply operations Supply join operation syntax. Select and project relevant rows and columns.
Limit access to data Exclude certain rows and/or columns from selection. Limit update to selected table rows and/or columns.
Reduce maintenance When you add or drop columns, applications are not affected (unless a view
references a dropped column). You can drop and recreate tables without affecting access rights granted to views.
Applications
SystemViews
DictionaryTABLE
Utilities
CoordinatedProducts
DictionaryTABLE
DictionaryTABLE
7/27/2019 B402 DD
7/40
Supplied Dictionary Views
ADMINISTRATOR
SECURITY ADMINISTRATOR
SUPERVISORY USERS
END USERS
OPERATIONS CONTROL
Supplied DD/DViews
DictionaryTABLE
DictionaryTABLE
Dictionary
TABLE
Views are representations of data derived from tables.
View definitions are stored in DBC.TVM.
View column information is stored in DBC.TVFields.
DIP scripts install the dictionary views.
7/27/2019 B402 DD
8/40
Restricted Views
These views limit the scope of what a user can access in the DD/D.
Views with an [X] suffix typically make the following three tests beforereturning information to the user:
View used with suffix [x]Where the user owns the
selected objects
Where the user holdscertain rights on the
selected objects
Where the user is theselected object
DataDictionary
Tables
7/27/2019 B402 DD
9/40
Using Restricted Views
Views with an [x] suffix return information only on objects that the
requesting user:
Owns, or Has privileges on
The following query returns information about ALL parents and children
recorded in the underlying dictionary table:
SELECT Child, ParentFROM DBC.Children;
The restricted [x] version of this view selects only information on objects
owned by the executing user or that the requesting user has access to:
SELECT Child, ParentFROM DBC.ChildrenX;
7/27/2019 B402 DD
10/40
Selecting Information about Created Objects
DBC.Children[X] Hierarchical relationship information.
DBC.Databases[X] Database, user and immediate parent information.
DBC.Users Similar to Databases view, but includes columns specific to users.
DBC.Tables[X] Tables, views, macros, triggers, and stored procedures information.
DBC. ShowTblChecks Database table constraint information.
DBC.ShowColChecks Database column constraint information.
DBC.Columns[X] Information about columns in tables and views, and parameters in macros.
DBC.Indices[X] Table index information.
DBC.IndexConstraints (V2R5) - Provides information about index constraints, e.g., PPI definition.
DBC.AllTempTables Information about all global temporary tables materialized in the system.
DBC.Triggers Information about event-driven, specialized procedures attached to a singletable and stored in the database.
7/27/2019 B402 DD
11/40
7/27/2019 B402 DD
12/40
Databases View
SELECT DatabaseName (CHAR(10)) AS "Name",CreatorName (CHAR(10)) AS "Creator",CreateTimeStamp
,PermSpace (FORMAT 'zzz,zz9,999'),DBKind
FROM DBC.DatabasesWHERE DatabaseName LIKE 'TFACT%'ORDER BY 1;
Provides information about databases and users.
Example Results:
Example:For databases/users witha name of tfact%, find
the creator name, when itwas created, its max perm
space, and the type(database or user).
DBC.Databases[X]
DatabaseName CreatorName OwnerName AccountName
ProtectionType JournalFlag PermSpace SpoolSpace
TempSpace CommentString CreateTimeStamp LastAlterName
LastAlterTimeStamp DBKind AccessCount ** LastAccessTimeCount **
** Optional use in V2R5.1
Name Creator CreateTimeStamp PermSpace DBKind
TFACT DBC 2003-05-05 19:36:21 20,000,000 Dtfact01 Sysdba 2003-05-05 19:36:49 10,000,000 U
tfact02 Sysdba 2003-05-05 19:36:52 10,000,000 Utfact03 Sysdba 2003-05-05 19:36:55 10,000,000 U
7/27/2019 B402 DD
13/40
7/27/2019 B402 DD
14/40
Tables View
SELECT TRIM(DatabaseName) || '.' || TableNameAS "Qualified Name"
,TableKindFROM DBC.TablesWHERE TableName LIKE '%rights%'
ORDER BY 1, 2 ;
Provides information about tables, views, macros, journals, join indexes, hash
indexes, triggers, and stored procedures.
Example Results:
Example:List all tables, views ormacros that contain thecharacters rights in
their name.
Qualified Name TableKind
DBC.AccessRights TDBC.AllRights VDBC.AllRoleRights VDBC.UserGrantedRights V
DBC.UserRights VDBC.UserRoleRights V
DBC.Tables[X]
DataBaseName TableName Version TableKind
ProtectionType JournalFlag CreatorName RequestText
CommentString ParentCount ChildCount NamedTblCheckCount
UnnamedTblCheckExist PrimaryKeyIndexId CreateTimeStamp LastAlterNameLastAlterTimeStamp RequestTxtOverFlow AccessCount ** LastAccessTimeCount **
** Optional use in V2R5.1
7/27/2019 B402 DD
15/40
7/27/2019 B402 DD
16/40
Tables2 View
SELECT TVMName (CHAR(10)),TVMId,DatabaseId,ParentCount,ChildCount
FROM DBC.Tables2WHERE TVMName = 'Employee'AND ParentCount > 0;
Provides ID definition information about tables and the number of tables to
which they refer and are referenced.
Example Results:
Example:Display table IDinformation about tablesnamed Employee andwith a parent count
greater than 0.
DBC.Tables2
TVMName TVMId DatabaseId ParentCountChildCount
TVMName TVMId DatabaseId ParentCount ChildCount
EMPLOYEE 0000383E0000 00006804 3 3
7/27/2019 B402 DD
17/40
ShowTblChecks View
SELECT TableName (CHAR(10)),CheckName (CHAR(10)),TblCheck
FROM DBC.ShowTblChecksWHERE DatabaseName = 'TFACT';
Provides information about check constraints at the table level and named
column constraints.
Example Results:
Example:Display table constraintinformation.
DBC.ShowTblChecks
DatabaseName TableName CheckName TblCheckCreatorName CreateTimeStamp
TableName CheckName TblCheck
DEPARTMENT Dept_Chk1 CONSTRAINT "Dept_Chk1" CHECK ( "Dept_nu
EMPLOYEE Emp_Chk1 CONSTRAINT "Emp_Chk1" CHECK ( "Employe
JOB ? CHECK ( "Job_code" >= 3000 )
Note: The first two are named constraints and the third is an unnamedconstraint. All three of these constraints were created at the table level.
7/27/2019 B402 DD
18/40
ShowColChecks View
SELECT TableName (CHAR(10)),ColumnName (CHAR(10)),ColCheck
FROM DBC.ShowColChecksWHERE DatabaseName = 'TFACT';
Provides information about unnamed column check constraints.
Example Results:
Example:Show information aboutcolumn constraints for adatabase.
DBC.ShowColChecks
DatabaseName TableName ColumnName ColCheckCreatorName CreateTimeStamp
Note: A second set of Employee, Department, and Job tables were created withunnamed CHECK constraints at the column level.
TableName ColumnName ColCheck
EMP_2 employee_number CHECK ( "employee_number" >= 100000 )DEPT_2 dept_number CHECK ( "dept_number" >= 1000 )JOB_2 job_code CHECK ( job_code" >= 3000 )
7/27/2019 B402 DD
19/40
Columns View
SELECT ColumnName, ColumnFormat, DefaultValueFROM DBC.ColumnsWHERE DatabaseName = 'DBC'
AND TableName = 'ResCPUbyAMP' ;
Provides information about columns in tables and views, and parameters in macros andstored procedures.
Example Results:
Example:Use this view to show theparameters of the
DBC.ResCPUbyAMPmacro.
DBC.Columns[X]
DatabaseName TableName ColumnName ColumnFormatColumnTitle SPParameterType ColumnType ColumnLengthDefaultValue Nullable CommentString DecimalTotalDigitsDecimalFractionalDigits ColumnId UpperCaseFlag CompressibleCompressValue ColumnConstraint ConstraintCount CreatorName
CreateTimeStamp LastAlterName LastAlterTimeStamp CharTypeIdColType (V2R5) AccessCount ** LastAccessTimeStamp ** CompressValueList (V2R5)
** Optional use in V2R5.1
ColumnName ColumnFormat DefaultValue
FromDate YYYY-MM-DD DateFromNode X(6) '000-00'FromTime 99:99:99 0.00000000000000E000ToTime 99:99:99 9.99999000000000E005
ToDate YYYY-MM-DD DateToNode X(6) '999-99'
7/27/2019 B402 DD
20/40
Indices View
Provides information about each indexed column defined for each table.
SELECT ColumnName (CHAR(15)) AS "Column Name",UniqueFlag AS "Unique",IndexType AS "Type",IndexName AS "Name",IndexNumber AS "IndNo",ColumnPosition AS "ColPos"
FROM DBC.IndicesWHERE TableName = 'Emp_Phone'AND DatabaseName = DATABASEORDER BY IndNo, ColPos ;
Example Results:
Example:Select information aboutthe Employee Phone tableindices in the currentdatabase.
DBC.Indices
DatabaseName TableName IndexNumber IndexTypeUniqueFlag IndexName ColumnName ColumnPositionCreatorName CreateTimeStamp LastAlterName LastAlterTimeStampIndexMode (V2R5) AccessCount** LastAccessTimeStamp**
** Optional use in V2R5.1
Column Name Unique Type Name IndNo ColPos
employee_number N P ? 1 1
area_code N S ac_phone 4 1phone_number N S ac_phone 4 2
7/27/2019 B402 DD
21/40
Indices View (Second Example)
Example Results:
Example:
Select informationabout the Departmenttable indices in thecurrent database.
SELECT ColumnName (CHAR(15)) AS "Column Name"
,UniqueFlag AS "Unique",IndexType AS "Type",IndexName AS "Name",IndexNumber AS "IndNo",ColumnPosition AS "ColPos"
FROM DBC.IndicesWHERE TableName = 'Department'
AND DatabaseName = DATABASEORDER BY IndNo, ColPos ;
Column Name Unique Type Name IndNo ColPos
dept_number Y P ? 1 1dept_name Y U ? 4 1
dept_number N J ? 8 1dept_name N J ? 8 2dept_mgr_number N J ? 8 3
SQL of how this Join Index was created:
CREATE JOIN INDEX Dept_JnIx AS SELECT dept_number, dept_name, dept_mgr_number
FROM DepartmentPRIMARY INDEX (dept_mgr_number);
7/27/2019 B402 DD
22/40
IndexConstraints View
Provides information about partitioned primary index constraints.
This view only displays tables with an index constraint type of "Q".
Q indicates a table with a PPI
SELECT TableName AS "Table Name",ConstraintText AS "Constraint Text"
FROM DBC.IndexConstraints
WHERE DatabaseName = DATABASE;
Example Results:
Example:List all of the partitioningexpression constraints
for all tables in thecurrent database.
DBC.IndexConstraints
DatabaseName TableName IndexName IndexNumberConstraintType ConstraintText ConstraintCollation CollationNameCreatorName CreateTimeStamp
Table Name Constraint Text
Sales_History CHECK ((RANGE_N("sales_date" BETWEEN ...Store_Sales CHECK ((store_id ) BETWEEN 1 and 65535)
Store_Item CHECK ((((store_id - 1000)* 1000) + (item_id - Store_Revenue CHECK ((CASE_N(total_revenue < 2000, ...
7/27/2019 B402 DD
23/40
AllTempTables View
SELECT HostNo,SessionNo,UserName (CHAR(10)),B_DatabaseName
AS "DataBase",B_TableName AS "Table Name"
FROM DBC.AllTempTables;
Provides information about all global temporary tables materialized in the
system.
Example Results:
Example:Show all temporary tablesmaterialized in thesystem.
DBC.AllTempTables[X]
HostNo SessionNo UserName B_DatabaseNameB_TableName E_TableID
HostNo SessionNo UserName Database Table Name
01 20887 TFACT02 PD GT_DEPTSALARY01 20908 TFACT01 PD GT_DEPTSALARY
7/27/2019 B402 DD
24/40
7/27/2019 B402 DD
25/40
Time Stamps in Data Dictionary
SELECT TRIM(DatabaseName) || '.' || TableNameAS "Qualified Name"
,LastAlterName AS "User Name",LastAlterTimeStamp AS "Last Alter Date & Time"
FROM DBC.TablesWHERE EXTRACT (YEAR FROM LastAlterTimeStamp) = 2003AND EXTRACT (MONTH FROM LastAlterTimeStamp) = 6
ORDER BY 1, 2 ;
Teradata RDMS features a time stamp in the Data Dictionary tables.
CreateTimeStamp, CreatorName, LastAlterTimeStamp, LastAlterName
This feature can help system administration tasks by providing a means toidentify objects recently updated, obsolete objects, etc. and who altered theobjects.
Example Results:
Example:List all tables that havebeen altered in June of2003.
Qualified Name User Name Last Alter Date & Time
DS.Sales_History tfact03 2003-06-21 10:04:04
PD.Department tfact04 2003-06-10 08:23:32
PD.Employee tfact04 2003-06-10 09:41:18PD.Job tfact04 2003-06-10 09:43:56
7/27/2019 B402 DD
26/40
Teradata Administrator
List Columns of a View
Appendix E ofthis manualcontains a listingof all the DD/Dviews andcolumns for
Teradata V2R5.1.
Teradata Administrator can be used to list the columns of DD/D views (and tables).
7/27/2019 B402 DD
27/40
Teradata Administrator
Object Options
TeradataAdministrator canalso be used todisplay object details.
For example, right-
click on the object(e.g., Departmenttable) and a menu ofoptions is displayed.
In this example, theIndexes option was
selected.
7/27/2019 B402 DD
28/40
7/27/2019 B402 DD
29/40
Review Questions
1. True or False. The DBC.Databases view only contains information about databases;users are not included in this view.
2. True or False. The DBC.Users view only contains information about users;databases are not included in this view.
3. True or False. Queries that use restricted views usually take less time to executethan queries that use unrestricted views.
4. True or False. All of the data dictionary tables are Fallback protected.
7/27/2019 B402 DD
30/40
Module 2: Review Question Answers
1. True orFalse. The DBC.Databases view only contains information about databases;users are not included in this view.
2. Trueor False. The DBC.Users view only contains information about users;databases are not included in this view.
3. True orFalse. Queries that use restricted views usually take less time to executethan queries that use unrestricted views.
4. True orFalse. All of the data dictionary tables are Fallback protected.
7/27/2019 B402 DD
31/40
Lab Exercises
Lab Exercise 2-1
Purpose
In this lab, you will use BTEQ or SQL Assistant to view information in the data dictionary using variousData Dictionary views (use Appendix E for the most accurate view information).
What you need
SELECT Access to the Data Dictionary views.
Tasks
1. Using the DBC.DBCInfo view, find the release and version of the system on which you are logged on:
Release ___________________ Version ___________________
2. Using the DBC.Children view, list your parents user names.
___________________ __________________ ___________________ ___________________
3. Using the DBC.Databases view, find your:
Immediate parents name ________________Creators name ________________Default account code ________________Perm space limit ________________
Spool space limit ________________Temp space limit ________________
7/27/2019 B402 DD
32/40
Lab Exercises
Lab Exercise 2-1 (cont.)
Tasks
4. Using the DBC.Users view, find your:
Default database name _________________Default collation sequence _________________Default date format _________________Create time stamp _________________
Last password modification date _________________
OPTIONAL: SHOW this view. Note the WHERE conditions. (Remember, this is a restricted view, eventhough it does not have an [X] suffix.)
5. Using the DBC.Tables view, find the number of tables in the DD/D (User DBC) that are:
Fallback protected __________________
Not Fallback protected __________________
Modify the query to find the number of tables OTHER THAN DD/D that are:
Fallback protected __________________
Not Fallback protected __________________
7/27/2019 B402 DD
33/40
Lab Exercises
Lab Exercise 2-1
Tasks
6. Using the DBC.Columns view, find the number of columns in the entire system defined with defaultvalues:
Number of columns _________________
OPTIONAL: Modify the query to find the number of tables that have columns defined with defaultvalues:
Number of tables _________________
7. Using the Indices view, find the number of tables OTHER THAN Dictionary tables that have non-uniqueprimary indexes (NUPI):
Number of tables _________________
OPTIONAL: Modify the query to list the DatabaseName and NUPI count for each database that starts
with the letter T.
7/27/2019 B402 DD
34/40
Lab Solutions for Lab 2-1
Lab Exercise 2-1
1. Using the DBC.DBCInfo view, find the release and version of the system on which you are logged on:
SELECT *FROM DBC.DBCInfo ;
InfoKey InfoDataVERSION 05.00.00.12RELEASE V2R.05.00.00.11
2. Using the DBC.Children view, list your parents userids:
SELECT ParentFROM DBC.ChildrenWHERE Child = USER;
ParentDBCSYSDBATeradata_FactoryLJC_Students
7/27/2019 B402 DD
35/40
Lab Solutions for Lab 2-1
Lab Exercise 2-1 (cont.)
3. Using the DBC.Databases view, find your:
SELECT *FROM DBC.DatabasesWHERE Databasename = USER ;
Immediate parents name LJC_Students
Creators name LJC_StudentsDefault account code $M_9038Perm space limit 15,000,000Spool space limit 200,000,000Temp space limit 100,000,000
4. Using the DBC.Users view, find your:
SELECT *FROM DBC.UsersWHERE UserName = USER ;
Default database name ?Default collation sequence HDefault date format ?
Create Time Stamp 2003-04-28 14:22:05Last password modification date 2003-04-28
7/27/2019 B402 DD
36/40
Lab Solutions for Lab 2-1
Lab Exercise 2-1 (cont.)
4. OPTIONAL: SHOW this view. Note the WHERE conditions. (Remember, this is a restricted view, eventhough it does not have an [X] suffix.)
REPLACE VIEW DBC.UsersAS SELECT
dbase.DatabaseName(NAMED UserName),dbase.CreatorName,
...
5. Using the DBC.Tables view, find the number of tables in the DD/D (User DBC) that are:
Fallback protected Count is 92
SELECT Count(*)FROM DBC.Tables
WHERE DatabaseName = 'DBC'AND TableKind = 'T' AND ProtectionType = 'F';
Not Fallback protected Count is 12
SELECT Count(*)FROM DBC.TablesWHERE DatabaseName = 'DBC'
AND TableKind = 'T' AND ProtectionType = 'N';
7/27/2019 B402 DD
37/40
Lab Solutions for Lab 2-1
Lab Exercise 2-1 (cont.)
5. OPTIONAL: Modify the query to find the number of tables OTHER THAN DD/D that are:
Fallback protected Count will vary - 564
SELECT Count(*)FROM DBC.TablesWHERE DatabaseName NE 'DBC'
AND TableKind = 'T'AND ProtectionType = 'F';
Not Fallback protected Count will vary - 6669
SELECT Count(*)FROM DBC.TablesWHERE DatabaseName NE 'DBC'
AND TableKind = 'T'AND ProtectionType = 'N';
7/27/2019 B402 DD
38/40
7/27/2019 B402 DD
39/40
Lab Solutions for Lab 2-1
Lab Exercise 2-1 (cont.)
7. Using the Indices view, find the number of tables OTHER THAN Dictionary tables that have non-uniqueprimary indexes (NUPI):
Number of tables Count will vary - 2560
SELECT COUNT (DISTINCT(DatabaseName || TableName))
FROM DBC.IndicesWHERE IndexType IN ('P', 'Q')AND UniqueFlag = 'N'AND DatabaseName NE 'DBC';
Count(Distinct(TableName))2560
Note: The IndexType of 'P' is used for the primary index of non-partitioned tables.The IndexType of 'Q' is used for the primary index of partitioned tables.
L b S l ti f L b 2 1
7/27/2019 B402 DD
40/40
Lab Solutions for Lab 2-1
Lab Exercise 2-1 (cont.)
7. OPTIONAL: Modify the query to list the DatabaseName and NUPI count for each database that startswith the letter T.
SELECT DatabaseName,COUNT (DISTINCT(TableName)) AS "Total NUPI Tables"
FROM DBC.IndicesWHERE IndexType IN ('P', 'Q')
AND UniqueFlag = 'N'AND DatabaseName LIKE 'T%'GROUP BY 1ORDER BY 2 DESC;
DatabaseName Total NUPI Tablestljc02 6tljc08 5tljc09 4tljc15 4tljc13 4
Note: The IndexType of 'P' is used for the primary index of non-partitioned tables.The IndexType of 'Q' is used for the primary index of partitioned tables.