• <i id='BKPCb'><tr id='BKPCb'><dt id='BKPCb'><q id='BKPCb'><span id='BKPCb'><b id='BKPCb'><form id='BKPCb'><ins id='BKPCb'></ins><ul id='BKPCb'></ul><sub id='BKPCb'></sub></form><legend id='BKPCb'></legend><bdo id='BKPCb'><pre id='BKPCb'><center id='BKPCb'></center></pre></bdo></b><th id='BKPCb'></th></span></q></dt></tr></i><div id='BKPCb'><tfoot id='BKPCb'></tfoot><dl id='BKPCb'><fieldset id='BKPCb'></fieldset></dl></div>

      <bdo id='BKPCb'></bdo><ul id='BKPCb'></ul>

    1. <legend id='BKPCb'><style id='BKPCb'><dir id='BKPCb'><q id='BKPCb'></q></dir></style></legend>

        <small id='BKPCb'></small><noframes id='BKPCb'>

        <tfoot id='BKPCb'></tfoot>

        如何查看表或列的所有外键?

        时间:2023-08-17
          <tbody id='FwGeD'></tbody>
        <i id='FwGeD'><tr id='FwGeD'><dt id='FwGeD'><q id='FwGeD'><span id='FwGeD'><b id='FwGeD'><form id='FwGeD'><ins id='FwGeD'></ins><ul id='FwGeD'></ul><sub id='FwGeD'></sub></form><legend id='FwGeD'></legend><bdo id='FwGeD'><pre id='FwGeD'><center id='FwGeD'></center></pre></bdo></b><th id='FwGeD'></th></span></q></dt></tr></i><div id='FwGeD'><tfoot id='FwGeD'></tfoot><dl id='FwGeD'><fieldset id='FwGeD'></fieldset></dl></div>

        1. <legend id='FwGeD'><style id='FwGeD'><dir id='FwGeD'><q id='FwGeD'></q></dir></style></legend>
          <tfoot id='FwGeD'></tfoot>

                  <bdo id='FwGeD'></bdo><ul id='FwGeD'></ul>

                  <small id='FwGeD'></small><noframes id='FwGeD'>

                  本文介绍了如何查看表或列的所有外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 MySQL 中,如何获取指向特定表的所有外键约束的列表?特定的列?这与这个 Oracle 问题相同,但适用于 MySQL.>

                  In MySQL, how do I get a list of all foreign key constraints pointing to a particular table? a particular column? This is the same thing as this Oracle question, but for MySQL.

                  推荐答案

                  对于表格:

                  SELECT 
                    TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
                  FROM
                    INFORMATION_SCHEMA.KEY_COLUMN_USAGE
                  WHERE
                    REFERENCED_TABLE_SCHEMA = '<database>' AND
                    REFERENCED_TABLE_NAME = '<table>';
                  

                  对于一列:

                  SELECT 
                    TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
                  FROM
                    INFORMATION_SCHEMA.KEY_COLUMN_USAGE
                  WHERE
                    REFERENCED_TABLE_SCHEMA = '<database>' AND
                    REFERENCED_TABLE_NAME = '<table>' AND
                    REFERENCED_COLUMN_NAME = '<column>';
                  

                  基本上,我们在 where 子句中将 REFERENCED_TABLE_NAME 更改为 REFERENCED_COLUMN_NAME.

                  Basically, we changed REFERENCED_TABLE_NAME with REFERENCED_COLUMN_NAME in the where clause.

                  这篇关于如何查看表或列的所有外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 MySQL 中进行批量插入 下一篇:如何在 MySQL 中临时禁用外键约束?

                  相关文章

                  最新文章

                • <tfoot id='TVZBx'></tfoot>

                • <i id='TVZBx'><tr id='TVZBx'><dt id='TVZBx'><q id='TVZBx'><span id='TVZBx'><b id='TVZBx'><form id='TVZBx'><ins id='TVZBx'></ins><ul id='TVZBx'></ul><sub id='TVZBx'></sub></form><legend id='TVZBx'></legend><bdo id='TVZBx'><pre id='TVZBx'><center id='TVZBx'></center></pre></bdo></b><th id='TVZBx'></th></span></q></dt></tr></i><div id='TVZBx'><tfoot id='TVZBx'></tfoot><dl id='TVZBx'><fieldset id='TVZBx'></fieldset></dl></div>
                  <legend id='TVZBx'><style id='TVZBx'><dir id='TVZBx'><q id='TVZBx'></q></dir></style></legend>
                    <bdo id='TVZBx'></bdo><ul id='TVZBx'></ul>

                    <small id='TVZBx'></small><noframes id='TVZBx'>