Please tell me a query to find the Primary key,Foreign
key,primary Index,PPI for the Database?

Answers were Sorted based on User's Feedback



Please tell me a query to find the Primary key,Foreign key,primary Index,PPI for the Database?..

Answer / bhanu prasad

We can find the information of all the indexes in the
system table "dbc.indices"

Is This Answer Correct ?    19 Yes 4 No

Please tell me a query to find the Primary key,Foreign key,primary Index,PPI for the Database?..

Answer / innocent

Hi Parsad,
I hope by running below query you'll get many part of your
answer.

_----------------------------------------------------------_
Select DatabaseName, TableName ,columnName,
Case When IndexType='K' Then 'Primary Key'
When IndexType='S' Then 'Secondary Index'
When IndexType='P' Then 'Primary Index'
When IndexType='Q' Then 'PPIndex'
When IndexType='J' Then 'Join Index'
End as implimented_Index
From DBC.Indices
Where TableName in
( Select distinct TableName
From DBC.Tablesize
Where DatabaseName <>'DBC'
And
CurrentPerm>0
)
Order by 1,2,3



_
Innocent

Is This Answer Correct ?    6 Yes 0 No

Please tell me a query to find the Primary key,Foreign key,primary Index,PPI for the Database?..

Answer / innocent

--Find indixes.
Select TableName,ColumnName,IndexType,UniqueFlag,IndexName
From DBC.Indices
Where tableName='mytable_name'

Is This Answer Correct ?    6 Yes 1 No

Please tell me a query to find the Primary key,Foreign key,primary Index,PPI for the Database?..

Answer / yuvaevergreen

Adding to the above,DBC.Indexes can be used to find whether
the index is PPI or join or hash or primary key.

Is This Answer Correct ?    5 Yes 0 No

Please tell me a query to find the Primary key,Foreign key,primary Index,PPI for the Database?..

Answer / prasanna

Hi Innocent,

Appreciate for your answer.

But one small correction is that tablename and database name columns are present in DBC.indices itself where as you had went for a join condition with dbc.tablesize.

so without join condition we can take both tablename and database  from dbc.indices table.

Thanks
Prasanna.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Teradata Interview Questions

What is SQL Assistence?please eample

4 Answers   IBM,


How do you verify a complicated sql?

0 Answers  


Hi friends This is suneel and i am new to teradata. In both situvations teradata administrator and teradata sql assitant 12.0 1)How to create database in teradata and under database how to create user. 2)How to create table under that user and giving privilizes to that user. Thanks alot.

1 Answers  


how many modules are there in telecome domain?how to explain the architecture?

0 Answers  


how do you manage the production space. what are the proactive methods you can take ?

0 Answers  


What is database exceptions in teradata?

0 Answers  


Why FLOAD doesn't supports NUSI? Where as Mload supports NUSI. Please explain in this regard. Thanks in advance.

4 Answers   Teradata,


Difference between stored procedure and macro?

0 Answers  


IS IT POSSIBLE THAT THERE R TWO PRIMARY KEY WILL BE IN A SAME TABLE?PLZ HELP ME BY GIVING THE ANSWER.THANK U.

10 Answers  


in ur table contains the coloumns like deptno,sal empname then i want output as deptno subtotalofdept totalsal 10 3700 3700 20 3400 7100 like that

1 Answers   IBM,


what is differences between Fastload and Multiload as per DBA aspect ?

1 Answers   Wipro,


IN A TABLE CAN WE USE PRIMARY KEY IN ONE COLUMN AND IN ANOTHER COLUMN BOTH UNIQUE AND NOT NULL CONSTRAINS.IF YES HOW?PLZ GIVE ME A EXAMPLE.

2 Answers  


Categories