Необходимо представить организационную иерархию в базе данных, т.е
Group 0 { Group 1 { Group 1.1 ... Group 1.N }, Group 2 { Group 2.1 ... Group 2.N } ... Group N }
CREATE TABLE "main"."groups" (
"id" INTEGER,
"name" TEXT NOT NULL,
PRIMARY KEY ("id" ASC)
);
CREATE TABLE "main"."groups_in_groups" (
"id" INTEGER NOT NULL,
"group_one_id" INTEGER NOT NULL,
"group_two_id" INTEGER NOT NULL,
PRIMARY KEY ("id"),
CONSTRAINT "fkey0" FOREIGN KEY ("group_one_id") REFERENCES "groups" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "fkey1" FOREIGN KEY ("group_two_id") REFERENCES "groups" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
Можно ли считать это подходящим решением?