select* −>frominformation_schema.referential_constraints −>whereconstraint_schema='business'; 다음은 외래 키 제약 조건만 표시하는 출력입니다-+------ -"/> select* −>frominformation_schema.referential_constraints −>whereconstraint_schema='business'; 다음은 외래 키 제약 조건만 표시하는 출력입니다-+------ -">

 >  기사  >  데이터 베이스  >  MySQL에서 외래 키 제약 조건 목록 가져오기

MySQL에서 외래 키 제약 조건 목록 가져오기

PHPz
PHPz앞으로
2023-08-31 11:53:10703검색

MySQL에서 외래 키 제약 조건 목록 가져오기

여러 테이블을 포함하는 데이터베이스 "비즈니스"가 있다고 가정해 보겠습니다. 외래 키 제약 조건만 표시하려면 다음 쿼리를 사용하세요. -

mysql> select *
   −> from information_schema.referential_constraints
   −> where constraint_schema = 'business';

아래는 외래 키 제약 조건만 표시하는 출력입니다. -

+--------------------+-------------------+--------------------------+---------------------------+--------------------------+------------------------+--------------+-------------+-------------+-------------------+-----------------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME          | UNIQUE_CONSTRAINT_CATALOG | UNIQUE_CONSTRAINT_SCHEMA | UNIQUE_CONSTRAINT_NAME | MATCH_OPTION | UPDATE_RULE | DELETE_RULE | TABLE_NAME       | REFERENCED_TABLE_NAME |
+--------------------+-------------------+--------------------------+---------------------------+--------------------------+------------------------+--------------+-------------+-------------+-------------------+-----------------------+
| def                | business          | ConstChild               | def                       | business                 | PRIMARY                | NONE         | NO ACTION   | NO ACTION | childdemo         | parentdemo |
| def                | business          | ConstFK                  | def                       | business                 | PRIMARY                | NONE         | NO ACTION   | NO ACTION | tblf | tblp |
| def                | business          | constFKPK                | def                       | business                 | PRIMARY                | NONE         | NO ACTION   | NO ACTION | foreigntable      | primarytable1 |
| def                | business          | FKConst                  | def                       | business                 | PRIMARY                | NONE         | NO ACTION   | NO ACTION | foreigntabledemo | primarytabledemo |
| def                | business          | primarytable1demo_ibfk_1 | def                       | business                 | PRIMARY                | NONE         | NO ACTION   | NO ACTION | primarytable1demo| foreigntable1 |
| def                | business          | StudCollegeConst         | def                       | business                 | PRIMARY                | NONE         | NO ACTION   | NO ACTION   | studentenrollment| college |
+--------------------+-------------------+--------------------------+---------------------------+--------------------------+------------------------+--------------+-------------+-------------+-------------------+-----------------------+
6 rows in set (0.07 sec)

위 내용은 MySQL에서 외래 키 제약 조건 목록 가져오기의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 tutorialspoint.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제