create table users (UID int PRIMARY KEY AUTO_INCREMENT, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL);
create table questions (QID int PRIMARY KEY AUTO_INCREMENT, content TEXT, answerA TEXT, answerB TEXT, answerC TEXT, answerD TEXT, answerChar CHAR(1));
create table tests (TID int PRIMARY KEY AUTO_INCREMENT, rank boolean, correctAnswers int, testLength int, UID int, testTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (UID) REFERENCES users(UID));
create table testAnswers (TAID int PRIMARY KEY AUTO_INCREMENT, QID int, position int, answeredChar CHAR(1), correct boolean, TID int, FOREIGN KEY (QID) REFERENCES questions(QID), FOREIGN KEY (TID) REFERENCES tests(TID));
create table questionAnswers (QAID int PRIMARY KEY AUTO_INCREMENT, QID int, answerChar CHAR(1), correct boolean, UID int, questionTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (UID) REFERENCES users(UID), FOREIGN KEY (QID) REFERENCES questions(QID));
