1
CREATE SCHEMA test_constaints;
3
CREATE TABLE t1(a1 INT NOT NULL,
6
CREATE TABLE t2(b1 INT,
8
CONSTRAINT A1 FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2) ON UPDATE CASCADE ON DELETE NO ACTION);
9
SELECT CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, MATCH_OPTION, UPDATE_RULE, DELETE_RULE
10
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
11
WHERE CONSTRAINT_SCHEMA = 'test_constaints';
12
CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE
13
A1 test_constaints SIMPLE CASCADE NO ACTION
14
SELECT CONSTRAINT_NAME, CHECK_CLAUSE FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS
15
WHERE CONSTRAINT_SCHEMA = 'test_constaints';
16
CONSTRAINT_NAME CHECK_CLAUSE
17
SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME
18
FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
19
WHERE CONSTRAINT_SCHEMA = 'test_constaints';
20
TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME
21
SELECT TABLE_NAME,CONSTRAINT_NAME
22
FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE
23
WHERE CONSTRAINT_SCHEMA = 'test_constaints';
24
TABLE_NAME CONSTRAINT_NAME
27
DROP SCHEMA test_constaints;