I have a bunch of tables....with lots of colums in each of them. How do i know which of the columns in these tables is a primary key, foreign key...etc...?
I did "DESC <table name>";....but i couldn't make it out.
SELECT column_name
FROM all_cons_columns acc, all_constraints aco
WHERE acc.constraint_name = aco.constraint_name
AND constraint_type = 'P'
AND acc.table_name = 'MY_TABLE';
The select from sfvb will give you the Primary Key columns.
When setting type equal to 'R' (referencing) then you will get the Foreign Key Columns.
When type='C' you get the Check Constraints.
If you have access to Enterprise Manager it is the easiest to look into the tables to understand all the information in them.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.