39 lines
824 B
SQL
39 lines
824 B
SQL
CREATE TABLE subject(
|
|
id BIGSERIAL PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
direction VARCHAR(255) NOT NULL
|
|
);
|
|
|
|
CREATE TABLE teacher(
|
|
id BIGSERIAL PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL
|
|
);
|
|
|
|
|
|
CREATE TABLE student(
|
|
id BIGSERIAL PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
familyPos bool NOT NULL,
|
|
domitory bool NOT NULL
|
|
);
|
|
|
|
CREATE TABLE studentTransition(
|
|
id BIGSERIAL PRIMARY KEY,
|
|
studentid BIGINT REFERENCES student (id) NOT NULL,
|
|
operation VARCHAR(255) NOT NULL,
|
|
date timestamp
|
|
);
|
|
|
|
CREATE TABLE statement(
|
|
id BIGSERIAL PRIMARY KEY,
|
|
subjectid BIGINT REFERENCES subject (id) NOT NULL,
|
|
teacherid BIGINT REFERENCES teacher (id) NOT NULL,
|
|
date timestamp
|
|
);
|
|
|
|
CREATE TABLE marks(
|
|
statementid BIGINT REFERENCES statement (id) NOT NULL,
|
|
studentid BIGINT REFERENCES student (id) NOT NULL,
|
|
mark integer NOT NULL
|
|
);
|