MySQL: how can I see ALL constraints on a table? -
i'm learning sql , bothers me, seem unable find constraints on table. created table with
create table t2 (a integer not null primary key, b integer not null, constraint c1 check(b>0), constraint fk1 foreign key(a) references t1(a)); and added constraint with
alter table t2 add constraint c2 check (b<20); i tried see (four) constraints with
show table status tenn #-->the name of database 't2'; and then
show create table t2; and then
select * information_schema.key_column_usage table_name='t2'; and finally
select * information_schema.table_constraints table_name='t2'; but none of these shows 4 constraints. tell me how see of them?
thanks lot!
select column_name, constraint_name, referenced_column_name, referenced_table_name information_schema.key_column_usage table_name = 'table checked';
Comments
Post a Comment