Know which field is unique

0

I have a table in Oracle People,

nombre   varchar2 unique
apellido varchar2
edad     int

I would like to know what the query is to know which field of the table is unique

    
asked by sirdaiz 13.02.2018 в 12:04
source

1 answer

1

hello looking for the schema

SELECT * FROM ALL_CONSTRAINTS WHERE OWNER = 'schemaName'

on sql server would be

SELECT
 [schema] = OBJECT_SCHEMA_NAME([object_id]),
 [table]  = OBJECT_NAME([object_id]),
 [index]  = name, 
  is_unique_constraint,
  is_unique,
  is_primary_key
FROM sys.indexes

Remembering that the schema name is generally case insensitive and needs to be given in uppercase, for example 'WHERE OWNER =' MYSCHEMA '.

source

    
answered by 13.02.2018 / 13:24
source