oracle desc table primary key

Solutions on MaxInterview for oracle desc table primary key by the best coders in the world

showing results for - "oracle desc table primary key"
Heather
10 Nov 2017
1-- Primary key in a table
2SELECT * FROM ALL_CONSTRAINTS 		-- or DBA_CONSTRAINTS or UESR_CONSTRAINTS
3WHERE TABLE_NAME= 'table_name' AND CONSTRAINT_TYPE = 'P';
4-- With columns names:
5SELECT c.OWNER, c.TABLE_NAME, c.CONSTRAINT_NAME, c.CONSTRAINT_TYPE, 
6	col.COLUMN_NAME
7FROM ALL_CONSTRAINTS c
8JOIN ALL_CONS_COLUMNS col ON c.TABLE_NAME = col.TABLE_NAME 
9    AND c.CONSTRAINT_NAME = col.CONSTRAINT_NAME
10WHERE c.TABLE_NAME= 'table_name' AND c.CONSTRAINT_TYPE = 'P'
11ORDER BY c.TABLE_NAME, c.CONSTRAINT_NAME, col.COLUMN_NAME;
Luigi
25 Jun 2018
1SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner
2FROM all_constraints cons, all_cons_columns cols
3WHERE cols.table_name = 'TABLE_NAME'
4AND cons.constraint_type = 'P'
5AND cons.constraint_name = cols.constraint_name
6AND cons.owner = cols.owner
7ORDER BY cols.table_name, cols.position;
queries leading to this page
oracle query column primary keyhow to make primary key in oraclecomposite primary key in oracleoracle get pk tablesprimary key oracle syntaxoracle query select as keydesc of oracle table in queryhow to primary key in oracle sqlhow to check primary key in oracle databaseoracle create table primary keyoracle find primary keys in a tableget table column identity in oracle all cons columns colsget primary key of table oracleoracle get primary keyoracle table primary keyfind primary key of a table oracleoracle view primary keycreate primary key oracle sqladd primary key to a oracle tableoracle create table with primary key oracle get all tables and pkcreate table in oracle with primary keydesc table in oracle sqloracle get field pkoracle sql query primary keyprimary key on oracleprimary key oracle sqlhow to know primary key of a table in oracleoracle list primary keyquery to find primary key of a table in oracleprimary key in oracle tableoracle select primary keys tableconstraint primary key oracle coupleoracle primary keyset primary key in oracle sqloracle how to find primary key in a tabletables and primary keys query oracleoracle sql check table primary keyprimary key oracleoracle desc table primary keyoracle sql check primary keyprimary key in oracleget primary key of oracle table queryquery to check primary key of a table in oracleoracle get primary key of tableoracle desc tablehow to get primary key of table in oracleidentify primary key in oracle tablehow to find primary key in oraclehow to use primary key in oraclewrite primary key on oracleoracle check primary keyget primary key in oracle tablehow to create composite primary key in oracledesc table in oracleoracle desc table primary key