1

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

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
Maher
  • 11
  • 1
  • 5

1 Answers1

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