Skip to content

Instantly share code, notes, and snippets.

@styliii
Created October 4, 2012 15:31
Show Gist options
  • Save styliii/3834427 to your computer and use it in GitHub Desktop.
Save styliii/3834427 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