The document contains SQL statements that create database tables to store quiz and answer data. It defines tables for Quizzes, Questions, Answers, Submissions and linked AnswerSubmissions. Sample data is inserted, including a quiz on the syllabus with 2 questions and multiple choice answers, and a submission record with a perfect grade. Foreign keys are used to link the tables together.
The document contains SQL statements that create database tables to store quiz and answer data. It defines tables for Quizzes, Questions, Answers, Submissions and linked AnswerSubmissions. Sample data is inserted, including a quiz on the syllabus with 2 questions and multiple choice answers, and a submission record with a perfect grade. Foreign keys are used to link the tables together.
The document contains SQL statements that create database tables to store quiz and answer data. It defines tables for Quizzes, Questions, Answers, Submissions and linked AnswerSubmissions. Sample data is inserted, including a quiz on the syllabus with 2 questions and multiple choice answers, and a submission record with a perfect grade. Foreign keys are used to link the tables together.
The document contains SQL statements that create database tables to store quiz and answer data. It defines tables for Quizzes, Questions, Answers, Submissions and linked AnswerSubmissions. Sample data is inserted, including a quiz on the syllabus with 2 questions and multiple choice answers, and a submission record with a perfect grade. Foreign keys are used to link the tables together.
Download as TXT, PDF, TXT or read online from Scribd
Download as txt, pdf, or txt
You are on page 1of 2
DROP TABLE QuizAnswerSubmission;
DROP TABLE QuizSubmission;
DROP TABLE QuizAnswer; DROP TABLE QuizQuestion; DROP TABLE Quiz;
-- Create Quiz Table --
CREATE TABLE Quiz(QuizID NUMBER PRIMARY KEY, Title NVARCHAR2(50), Instructions NVARCHAR2(100), Points NUMBER, DueDateTime DATE, ShuffleAnswers CHAR(1), TimeLimitMinutes NUMBER, OneQuestionPerScreen CHAR(1));
-- Insert Quiz Record --
INSERT INTO Quiz(QuizID, Title, Instructions, Points, DueDateTime, ShuffleAnswers, TimeLimitMinutes, OneQuestionPerScreen) VALUES('101','WA 00 Syllabus Quiz', 'Read the syllabus', '6', TO_DATE('1/15/2022','MM/DD/YYYY'),'N','9999','N');
-- Create QuizQuestion Table --
CREATE TABLE QuizQuestion( ID NUMBER PRIMARY KEY, QuizID NUMBER NOT NULL, TEXT NVARCHAR2(100) NOT NULL, CONSTRAINT QuizQuestion_FK FOREIGN KEY(QuizID) REFERENCES Quiz(QuizID));
-- Create QuizAnswer Table --
CREATE TABLE QuizAnswer( ID NUMBER PRIMARY KEY, QuizQuestionID NUMBER NOT NULL, "Order" NUMBER NOT NULL, TEXT NVARCHAR2(100) NOT NULL, Correct CHAR(1), CONSTRAINT QuizAnswer_FK FOREIGN KEY(QuizQuestionID) REFERENCES QuizQuestion(ID));
-- Insert QuizQuestion Records --
INSERT INTO QuizQuestion(ID,QuizID,Text) VALUES ( 1, 101, 'This is sample quiz table'); INSERT INTO QuizQuestion(ID,QuizID,Text) VALUES ( 2, 101,'This is sample quiz table row 2');
-- Insert QuizAnswer Records --
INSERT INTO QuizAnswer(ID,QuizQuestionID, "Order",Text, Correct) VALUES(1, 1, 1, 'This is correct answer','Y'); INSERT INTO QuizAnswer(ID,QuizQuestionID, "Order",Text, Correct) VALUES(2, 1, 2, 'This is wrong answer','N'); INSERT INTO QuizAnswer(ID,QuizQuestionID, "Order",Text, Correct) VALUES(3, 2, 1, 'This is correct answer','Y'); INSERT INTO QuizAnswer(ID,QuizQuestionID, "Order",Text, Correct) VALUES(4, 2, 2, 'This is wrong answer','N');