SHARE
TWEET

Untitled

llownall Nov 12th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE teacher
  2. (
  3.     teacher_id SERIAL PRIMARY KEY,
  4.     login CHARACTER VARYING(50),
  5.     password CHARACTER VARYING(50)
  6. );
  7. CREATE TABLE test
  8. (
  9.     test_id SERIAL PRIMARY KEY,
  10.     name CHARACTER VARYING(200),
  11.     teacher_id INTEGER REFERENCES teacher (teacher_id) ON DELETE CASCADE
  12. );
  13. CREATE TABLE test_execution
  14. (
  15.     execution_id SERIAL PRIMARY KEY,
  16.     test_id INTEGER REFERENCES test (test_id) ON DELETE CASCADE,
  17.     date TIMESTAMP,
  18.     running BOOLEAN
  19. );
  20. CREATE TABLE question
  21. (
  22.     question_id SERIAL PRIMARY KEY,
  23.     test_id INTEGER REFERENCES test (test_id) ON DELETE CASCADE,
  24.     type INTEGER,
  25.     text CHARACTER VARYING(200),
  26.     image BYTEA,
  27.     answer1 CHARACTER VARYING(500),
  28.     answer2 CHARACTER VARYING(500),
  29.     answer3 CHARACTER VARYING(500),
  30.     answer4 CHARACTER VARYING(500),
  31.     right_answer INTEGER
  32. );
  33. CREATE TABLE result
  34. (
  35.     result_id SERIAL PRIMARY KEY,
  36.     student_name CHARACTER VARYING(200),
  37.     execution_id INTEGER REFERENCES test_execution (execution_id) ON DELETE CASCADE,
  38.     question_id INTEGER REFERENCES question (question_id) ON DELETE CASCADE,
  39.     answer INTEGER
  40. );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top