CREATE TABLE UPR
(
CODE NUMBER(9) NOT NULL,
NAME VARCHAR2(50)
)
;
ALTER TABLE UPR ADD CONSTRAINT PK_UPR
PRIMARY KEY (CODE)
USING INDEX
;
-- -------------------------------------
CREATE TABLE STRUCTURES
(
ID NUMBER(9) NOT NULL,
UPR NUMBER(9) NOT NULL,
SEQUENCE NUMBER(9) NOT NULL,
NAME VARCHAR2(50) NOT NULL
)
;
ALTER TABLE STRUCTURES ADD CONSTRAINT PK_STRUCTURES
PRIMARY KEY (ID)
USING INDEX
;
ALTER TABLE STRUCTURES ADD CONSTRAINT FK_STRUCTURES_UPR
FOREIGN KEY (UPR) REFERENCES UPR (CODE)
;
“附录”和“文档”的结构将遵循与“结构”相同的模式。
这有帮助吗?
编辑
要构建完整的 UPR,您将执行类似的操作
SELECT S.NAME, D.SEQUENCE FROM STRUCTURES S WHERE CODE = :SomeCode
UNION SELECT A.NAME, D.SEQUENCE FROM APPENDIX A WHERE A.UPR = S.CODE
UNION SELECT D.NAME, D.SEQUENCE FROM DOCUMENT D WHERE D.UPR = S.CODE
ORDER BY 2
顺便一提 ?什么是普遍定期审议?:)