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 are default access rights in teradata? What explicit right can be given to a user?

0 Answers  


How do you determine the number of sessions?

0 Answers  


Hi frinds pls help me regarding this question WHY usi is two amp operation in teradata? THANKS IN ADVANCE....

3 Answers  


I Have Name field in a Table Name ------------- abcde;fgh;ijk; abc;def;jklm;no I want to write a sql to display name field data with out ';'.so i want to replace ; with '' how will write in Teradata

3 Answers   Wipro,


If a Node is busy what are the steps you can take to avoid ?

0 Answers   Teradata,






There is a load to the Table every one hour and 24/7.Morning trafic is high, afternoon trafiic is less, Night trafiic is high.According to this situation which Utility you use and how do you load,which utility used?

4 Answers   IBM,


Can u load same data into multiple tables using multiload? How will be the loading process? Whether it will be serially or parallely?

2 Answers   IBM,


What is the diffrence between Multiload & Fastload interms of Performance?

8 Answers   Cap Gemini, Intel,


What are the scenarios in which full table scans occurs?

0 Answers  


How do you Generate Sequence in Teradata?

3 Answers   TCS,


What is meant by a Least Cost Plan?

0 Answers  


What are the differences between TerdataV2R5 and V12 Versions please??

3 Answers  


Categories