gpt4 book ai didi

sql - 如何判断HSQLDB中定义了哪些外键?

转载 作者:搜寻专家 更新时间:2023-10-30 20:02:59 24 4
gpt4 key购买 nike

我如何知道在 HSQLDB 中定义了哪些外键?

我从文档中收集到的最好的是:

select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;

但这只给了我以下内容。

CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE 
------------------ ----------------- --------------- ------------------------- ------------------------ ---------------------- ------------ ----------- -----------
PUBLIC PUBLIC SYS_FK_10078 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10079 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION NO ACTION
PUBLIC PUBLIC SYS_FK_10080 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10116 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10120 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10124 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION NO ACTION
PUBLIC PUBLIC SYS_FK_10128 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10131 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE

我需要知道哪些表和列分配了外键,并且我需要能够删除它们。

最佳答案

您可以将以下选择与 REFERENTIAL_CONSTRAINTS View 结合使用:

select * from information_schema.constraint_column_usage
select * from information_schema.constraint_table_usage

或者,INFORMATION_SCHEMA.SYSTEM_CROSSREFERENCE View 是外键及其表和列的独立 View 。

参见 http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_information_schema获取列表。

关于sql - 如何判断HSQLDB中定义了哪些外键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5777759/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com