Untitled

mail@pastecode.io avatar
unknown
sql
2 years ago
1.2 kB
2
Indexable
Never
CREATE TABLE Users(
    UserID int NOT NULL PRIMARY KEY,
    FirstName varchar(255) NOT NULL,
    LastName varchar(255) NOT NULL,
	Email varchar(255) NOT NULL,
	Score int
);

CREATE TABLE Questions(
    QuestionID int NOT NULL PRIMARY KEY,
    QuestionType varchar(255) NOT NULL,
    Question varchar(4096) NOT NULL
);

CREATE TABLE ClosedQuestionsAnswears(
    FOREIGN KEY (QuestionID) REFERENCES Questions(QuestionID);
    QuestionType varchar(64) NOT NULL,
    AnswearA varchar(1024) NOT NULL,
    AnswearB varchar(1024) NOT NULL,
    AnswearC varchar(1024) NOT NULL,
    AnswearD varchar(1024) NOT NULL,
    CorrectAnswear varchar(1024) NOT NULL
)

CREATE TABLE OpenQuestionsAnswears(
    FOREIGN KEY (QuestionID) REFERENCES Questions(QuestionID);
    QuestionType varchar(255) NOT NULL,
    CorrectAnswear varchar(8000) NOT NULL
)

CREATE TABLE UserQuestionAnswears(
    UserQuestionAnswearID int NOT NULL PRIMARY KEY,
    UserQuestionType varchar(64) NOT NULL,
    UserQuestionAnswear varchar (8000) NOT NULL,
    FOREIGN KEY (UserID) REFERENCES User(UserID),
	FOREIGN KEY (QuestionID) REFERENCES Questions(QuestionID)
)