Untitled

mail@pastecode.io avatar
unknown
sql
3 years ago
1.3 kB
2
Indexable
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 OpenQuestionsAnswears(
    FOREIGN KEY (QuestionID) REFERENCES Questions(QuestionID);
    OpenQuestionAnswear varchar(8000) NOT NULL
)

CREATE TABLE ClosedQuestionAnswears(
	FOREIGN KEY(QuestionID) REFERENCES Questions(QuestionID);
	AnswearA varchar(1024) NOT NULL,
    AnswearB varchar(1024) NOT NULL,
    AnswearC varchar(1024) NOT NULL,
    AnswearD varchar(1024) NOT NULL,
    AnswearX varchar(1024) //ALTER TABLE 
)
	
CREATE TABLE CorrectQuestionAnswears(
	FOREIGN KEY(QuestionID) REFERENCES Questions(QuestionID);
	CorrectOpenQuestionAnswear varchar(8000),
	CorrectClosedQuestionAnswear int
)

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