i am stuck. i don't know what is the query of SQL+ (Oracle) that allows me to show the primary key of a specific table of a database (by the way i know the name of table after using "select table_name from user_tables;) in MYSQL we use " SHOW KEYS FROM table WHERE Key_name = 'PRIMARY' " but i don't know how to do it using SQL+ (Oracle) Thank you very much for you attention
Asked
Active
Viewed 3,846 times
1 Answers
1
You can show the prymary key of a specific table with the following query:
SELECT constraint_name
FROM user_constraints
WHERE table_name = 'TABLE_NAME'
AND constraint_type = 'P'

Henique
- 75
- 1
- 8
-
create table JOUE ( NOM_ACTEUR VARCHAR2(30) not null, TITRE VARCHAR2(40) not null, constraint PK_JOUE primary key (NOM_ACTEUR, TITRE), constraint FK_JOUE_JOUER_FILM foreign key (TITRE) references FILM (TITRE) ); SELECT constraint_name FROM user_constraints WHERE table_name = 'TABLE_NAME' AND constraint_type = 'P' – Maher Apr 14 '20 at 15:18