Database schema for Online Examination System

Designing a database schema for an Online Examination System involves capturing information related to exams, questions, users, and results. Below is a basic example of a database schema for an Online Examination System.


  1. User:

    • UserID (Primary Key)
    • FirstName
    • LastName
    • Username
    • PasswordHash
    • Email
    • Role (e.g., student, teacher, admin)
  2. Exam:

    • ExamID (Primary Key)
    • Title
    • Description
    • StartTime
    • EndTime
    • Duration
    • Status (e.g., upcoming, ongoing, completed)
  3. Question:

    • QuestionID (Primary Key)
    • ExamID (Foreign Key referencing Exam table)
    • QuestionText
    • QuestionType (e.g., multiple choice, true/false, short answer)
    • Options (for multiple-choice questions)
    • CorrectAnswer (for auto-grading)
  4. UserExamAttempt:

    • AttemptID (Primary Key)
    • UserID (Foreign Key referencing User table)
    • ExamID (Foreign Key referencing Exam table)
    • StartTime
    • EndTime
    • Status (e.g., started, submitted)
  5. UserExamResponse:

    • ResponseID (Primary Key)
    • AttemptID (Foreign Key referencing UserExamAttempt table)
    • QuestionID (Foreign Key referencing Question table)
    • UserResponse
    • IsCorrect (for auto-grading)
  6. ExamResult:

    • ResultID (Primary Key)
    • UserID (Foreign Key referencing User table)
    • ExamID (Foreign Key referencing Exam table)
    • Score
    • MaxScore
    • Percentage
    • PassStatus

This schema covers the basic entities needed for an Online Examination System. Here are some explanations:

  • Users have personal information stored, including their username, password hash, email, and role (student, teacher, admin).
  • Exams are defined with details such as title, description, start time, end time, duration, and status.
  • Questions are associated with specific exams and have details like question text, type, options (for multiple-choice questions), and correct answers.
  • UserExamAttempt records each attempt by a user to take an exam, including start time, end time, and status.
  • UserExamResponse stores user responses to individual questions during an exam attempt.
  • ExamResult captures the result of a user's attempt at an exam, including the score, maximum score, percentage, and pass status.

Depending on the specific requirements of your Online Examination System, you may need to expand or modify this schema. Consider additional features such as randomizing question order, exam categories, time tracking, or any other information relevant to your online examination platform. Additionally, ensure that your system addresses security concerns to maintain the integrity of the examination process.