title: MySQL: how can I see ALL constraints on a table?
body: <p>I'm learning SQL and what bothers me, is that I seem unable to find ALL constraints on a table. I created the table with</p>
  
  <pre><code>create table t2
  (a integer not null primary key,
  b integer not null, constraint c1 check(b&gt;0),
  constraint fk1 foreign key(a) references t1(a));
  </code></pre>
  
  <p>and added a constraint with</p>
  
  <pre><code>alter table t2
  add constraint c2 check (b&lt;20);
  </code></pre>
  
  <p>I then tried to see ALL (four) constraints with</p>
  
  <pre><code>show table status
  from tenn #--&gt;the name of my database
  like 't2';
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>show create table t2;
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>select *
  from information_schema.key_column_usage
  where table_name='t2';
  </code></pre>
  
  <p>and finally</p>
  
  <pre><code>select *
  from information_schema.table_constraints
  where table_name='t2';
  </code></pre>
  
  <p>But none of these shows all four constraints. Could anyone tell me how to see all of them?</p>
  
  <p>Thanks a lot!</p>