MySQL: List all Contraints on a Table

logo-mysql-110x57

Sometimes it is useful to show all your constraints, you have set on a Table in your Database. To achive this, type the following statement

SELECT DISTINCT(constraint_name) from information_schema.table_constraints where constraint_schema = '' order by constraint_name ASC;

MySQL should return a list like this, depends on your constraints

+------------------------+
| constraint_name        |
+------------------------+
| bugsnumk               |
| casesnumk              |
| ckey                   |
| PRIMARY                |
| upgrade_history_md5_uk |
+------------------------+
5 rows in set (0.70 sec)