Skip to content

Instantly share code, notes, and snippets.

@xta
Forked from styliii/quizschema.sql
Created October 4, 2012 20:13
Show Gist options
  • Save xta/3836119 to your computer and use it in GitHub Desktop.
Save xta/3836119 to your computer and use it in GitHub Desktop.
Setting up the Database
CREATE TABLE user (
id INTEGER PRIMARY KEY,
first_name TEXT,
email TEXT
);
CREATE TABLE quiz (
id INTEGER PRIMARY KEY,
user_id INTEGER,
name TEXT
);
CREATE TABLE question (
id INTEGER PRIMARY KEY,
content TEXT
);
CREATE TABLE quiz_question (
id INTEGER PRIMARY KEY,
quiz_id INTEGER,
question_id INTEGER
);
CREATE TABLE choice (
id INTEGER PRIMARY KEY,
content TEXT,
question_id INTEGER,
correct BOOLEAN
);
CREATE TABLE answer (
id INTEGER PRIMARY KEY,
user_id INTEGER,
question_id INTEGER,
choice_id INTEGER
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment