top of page

Subscribe to Wisdom

Thanks for Subscribing!

  • Writer's picturePuru Uttam

Get All Constraints from database

Queries mentioned below are useful in getting knowledge about all constraints in a database. This is useful in cases where you have huge database & thus tables


select constraint_name, table_schema, table_name
from information_schema.table_constraints
where
constraint_schema = '<your db schema>'

SELECT CONSTRAINT_NAME,
UNIQUE_CONSTRAINT_NAME,
MATCH_OPTION,
UPDATE_RULE,
DELETE_RULE,
TABLE_NAME,
REFERENCED_TABLE_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA = '<your db schema>'
4 views0 comments

Kommentare


Modern Digital Watch
bottom of page