DROP TABLE ELEMENT;
DROP TABLE DUMMY_ENTITY;

DROP TABLE root;
DROP TABLE intermediate;
DROP TABLE leaf;

CREATE TABLE DUMMY_ENTITY
(
    ID   NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
    NAME VARCHAR2(100)
);

CREATE TABLE ELEMENT
(
    ID               NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
    CONTENT          VARCHAR(100),
    DUMMY_ENTITY_KEY NUMBER,
    DUMMY_ENTITY     NUMBER
);

CREATE TABLE root
(
    id NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY
);
CREATE TABLE intermediate
(
    id       NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
    root     NUMBER NOT NULL,
    root_key NUMBER NOT NULL
);
CREATE TABLE leaf
(
    name             VARCHAR(100),
    intermediate     NUMBER NOT NULL,
    intermediate_key NUMBER NOT NULL
);
