kekmodel's picture
Add files using upload-large-folder tool
562924d verified
raw
history blame
1.35 kB
-- Schema: bird__computer_student
CREATE SCHEMA IF NOT EXISTS "bird__computer_student";
-- Table: advisedBy
CREATE TABLE "bird__computer_student"."advisedBy" (
"p_id" BIGINT NOT NULL,
"p_id_dummy" BIGINT NOT NULL,
CONSTRAINT "advisedBy_pk" PRIMARY KEY ("p_id", "p_id_dummy")
);
-- Table: course
CREATE TABLE "bird__computer_student"."course" (
"course_id" BIGINT NOT NULL,
"courseLevel" TEXT,
CONSTRAINT "course_pk" PRIMARY KEY ("course_id")
);
-- Table: person
CREATE TABLE "bird__computer_student"."person" (
"p_id" BIGINT NOT NULL,
"professor" BIGINT,
"student" BIGINT,
"hasPosition" TEXT,
"inPhase" TEXT,
"yearsInProgram" TEXT,
CONSTRAINT "person_pk" PRIMARY KEY ("p_id")
);
-- Table: taughtBy
CREATE TABLE "bird__computer_student"."taughtBy" (
"course_id" BIGINT NOT NULL,
"p_id" BIGINT NOT NULL,
CONSTRAINT "taughtBy_pkey" PRIMARY KEY ("course_id", "p_id")
);
-- Foreign Keys
ALTER TABLE "bird__computer_student"."taughtBy" ADD CONSTRAINT "fk_taughtBy_0" FOREIGN KEY ("course_id") REFERENCES "bird__computer_student"."course" ("course_id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "bird__computer_student"."taughtBy" ADD CONSTRAINT "fk_taughtBy_1" FOREIGN KEY ("p_id") REFERENCES "bird__computer_student"."person" ("p_id") ON DELETE NO ACTION ON UPDATE NO ACTION;