How can I get the foreign keys of a table in mysql

后端 未结 4 1458
小蘑菇
小蘑菇 2021-01-02 22:40

I am creating a class which, takes a table from a database, and displays it to a web-page, with as much functionality as possible. One of the things I would like to support,

4条回答
  •  清酒与你
    2021-01-02 23:09

    The INFORMATION_SCHEMA database contains details of the full schema of all other databases, including constraints:

    http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

    You can also run a SHOW CREATE TABLE query to get the SQL to create a table, including its constraints.

提交回复
热议问题