School DB Lab
Generated live from information_schema

Data Dictionary

The complete column-by-column reference for the whole database, plus the exact CREATE TABLE statement MySQL is actually running for each table.

پورے ڈیٹا بیس (Database) کے ہر ٹیبل اور کالم کی مکمل کالم-بہ-کالم حوالہ جاتی فہرست، بمعہ وہ اصل CREATE TABLE اسٹیٹمنٹ جو MySQL اس وقت ہر ٹیبل کے لیے چلا رہا ہے۔

attendance

Daily attendance, one row per student per class per date.

ColumnTypePKFKUniqueNullDefaultReferences
attendance_id bigint(20) unsigned ✓ NOT NULL — —
student_id bigint(20) unsigned ✓ ✓ NOT NULL — students.student_id
class_id bigint(20) unsigned ✓ ✓ NOT NULL — classes.class_id
attendance_date date ✓ NOT NULL — —
status enum('Present','Absent','Leave','Late') NOT NULL — —
remarks varchar(255) YES NULL —
created_at timestamp NOT NULL current_timestamp() —

classes

A class/section for one academic year, e.g. "Grade 5 - A - 2025-2026".

ColumnTypePKFKUniqueNullDefaultReferences
class_id bigint(20) unsigned ✓ NOT NULL — —
class_name varchar(40) ✓ NOT NULL — —
section varchar(10) ✓ NOT NULL — —
academic_year varchar(9) ✓ NOT NULL — —
room_no varchar(20) YES NULL —
capacity smallint(5) unsigned NOT NULL 30 —
created_at timestamp NOT NULL current_timestamp() —

class_subject_teachers

Assignment table answering: which teacher teaches which subject to which class.

ColumnTypePKFKUniqueNullDefaultReferences
assignment_id bigint(20) unsigned ✓ NOT NULL — —
class_id bigint(20) unsigned ✓ ✓ NOT NULL — classes.class_id
subject_id bigint(20) unsigned ✓ ✓ NOT NULL — subjects.subject_id
teacher_id bigint(20) unsigned ✓ NOT NULL — teachers.teacher_id
created_at timestamp NOT NULL current_timestamp() —

exams

One row per exam sitting for a given class.

ColumnTypePKFKUniqueNullDefaultReferences
exam_id bigint(20) unsigned ✓ NOT NULL — —
exam_name varchar(100) NOT NULL — —
class_id bigint(20) unsigned ✓ NOT NULL — classes.class_id
exam_date date NOT NULL — —
total_marks smallint(5) unsigned NOT NULL 100 —
created_at timestamp NOT NULL current_timestamp() —

exam_results

A student's marks for one subject in one exam.

ColumnTypePKFKUniqueNullDefaultReferences
result_id bigint(20) unsigned ✓ NOT NULL — —
exam_id bigint(20) unsigned ✓ ✓ NOT NULL — exams.exam_id
student_id bigint(20) unsigned ✓ ✓ NOT NULL — students.student_id
subject_id bigint(20) unsigned ✓ ✓ NOT NULL — subjects.subject_id
marks_obtained decimal(5,2) NOT NULL — —
grade varchar(2) YES NULL —
remarks varchar(255) YES NULL —
created_at timestamp NOT NULL current_timestamp() —

fee_invoices

One invoice per student per billing month.

ColumnTypePKFKUniqueNullDefaultReferences
invoice_id bigint(20) unsigned ✓ NOT NULL — —
student_id bigint(20) unsigned ✓ ✓ NOT NULL — students.student_id
invoice_month varchar(7) ✓ NOT NULL — —
amount decimal(10,2) NOT NULL — —
due_date date NOT NULL — —
status enum('Unpaid','Partially Paid','Paid','Overdue') NOT NULL 'Unpaid' —
created_at timestamp NOT NULL current_timestamp() —

fee_payments

Payments received against an invoice — one invoice may have several partial payments.

ColumnTypePKFKUniqueNullDefaultReferences
payment_id bigint(20) unsigned ✓ NOT NULL — —
invoice_id bigint(20) unsigned ✓ NOT NULL — fee_invoices.invoice_id
amount_paid decimal(10,2) NOT NULL — —
payment_date date NOT NULL — —
payment_method enum('Cash','Card','Bank Transfer','Online') NOT NULL — —
reference_no varchar(40) ✓ YES NULL —
created_at timestamp NOT NULL current_timestamp() —

lab_admins

ColumnTypePKFKUniqueNullDefaultReferences
admin_id int(10) unsigned ✓ NOT NULL — —
username varchar(60) ✓ NOT NULL — —
email varchar(190) ✓ YES NULL —
password_hash varchar(255) NOT NULL — —
display_name varchar(100) NOT NULL 'Administrator' —
is_active tinyint(1) NOT NULL 1 —
created_at timestamp NOT NULL current_timestamp() —
last_login_at datetime YES NULL —

lab_invitations

ColumnTypePKFKUniqueNullDefaultReferences
invite_id int(10) unsigned ✓ NOT NULL — —
invite_code varchar(32) ✓ NOT NULL — —
max_uses tinyint(4) NOT NULL 1 —
used_count tinyint(4) NOT NULL 0 —
expires_at datetime YES NULL —
is_revoked tinyint(1) NOT NULL 0 —
created_by int(10) unsigned YES NULL —
created_at timestamp NOT NULL current_timestamp() —

lab_login_attempts

ColumnTypePKFKUniqueNullDefaultReferences
attempt_id int(10) unsigned ✓ NOT NULL — —
ip_address varchar(45) NOT NULL — —
student_code varchar(20) YES NULL —
attempted_at timestamp NOT NULL current_timestamp() —

lab_record_ownership

ColumnTypePKFKUniqueNullDefaultReferences
ownership_id bigint(20) unsigned ✓ NOT NULL — —
table_name varchar(50) ✓ NOT NULL — —
record_id bigint(20) unsigned ✓ NOT NULL — —
student_token varchar(64) ✓ NOT NULL — lab_students.student_token
created_at timestamp NOT NULL current_timestamp() —

lab_settings

ColumnTypePKFKUniqueNullDefaultReferences
setting_key varchar(60) ✓ NOT NULL — —
setting_value varchar(255) NOT NULL '' —

lab_students

ColumnTypePKFKUniqueNullDefaultReferences
student_id int(10) unsigned ✓ NOT NULL — —
student_token varchar(64) ✓ NOT NULL — —
student_code varchar(20) ✓ NOT NULL — —
student_name varchar(100) NOT NULL 'Student' —
passkey_hash varchar(255) YES NULL —
password_hash varchar(255) YES NULL —
is_active tinyint(1) NOT NULL 1 —
must_change_pw tinyint(1) NOT NULL 0 —
created_by int(11) YES NULL —
created_at timestamp NOT NULL current_timestamp() —
last_active_at timestamp NOT NULL current_timestamp() —

lab_task_progress

ColumnTypePKFKUniqueNullDefaultReferences
progress_id bigint(20) unsigned ✓ NOT NULL — —
student_token varchar(64) ✓ ✓ NOT NULL — lab_students.student_token
task_key varchar(50) ✓ NOT NULL — —
status enum('unattempted','passed','failed') NOT NULL 'unattempted' —
submitted_answer text YES NULL —
feedback text YES NULL —
attempts_count int(10) unsigned NOT NULL 0 —
passed_at timestamp YES NULL —
updated_at timestamp NOT NULL current_timestamp() —

lab_teachers

ColumnTypePKFKUniqueNullDefaultReferences
teacher_id int(10) unsigned ✓ NOT NULL — —
username varchar(60) ✓ NOT NULL — —
email varchar(190) ✓ YES NULL —
password_hash varchar(255) NOT NULL — —
display_name varchar(100) NOT NULL 'Teacher' —
is_active tinyint(1) NOT NULL 1 —
created_at timestamp NOT NULL current_timestamp() —

parents

Parents/guardians. Never linked to students directly — always through student_parents.

ColumnTypePKFKUniqueNullDefaultReferences
parent_id bigint(20) unsigned ✓ NOT NULL — —
first_name varchar(60) NOT NULL — —
last_name varchar(60) NOT NULL — —
phone varchar(20) NOT NULL — —
email varchar(120) ✓ YES NULL —
address varchar(255) YES NULL —
created_at timestamp NOT NULL current_timestamp() —

students

The root entity. Most other tables ultimately point back to a student.

ColumnTypePKFKUniqueNullDefaultReferences
student_id bigint(20) unsigned ✓ NOT NULL — —
admission_no varchar(20) ✓ NOT NULL — —
first_name varchar(60) NOT NULL — —
last_name varchar(60) NOT NULL — —
date_of_birth date NOT NULL — —
gender enum('Male','Female','Other') NOT NULL — —
email varchar(120) ✓ YES NULL —
phone varchar(20) YES NULL —
status enum('Active','Inactive','Graduated','Withdrawn') NOT NULL 'Active' —
created_at timestamp NOT NULL current_timestamp() —
updated_at timestamp NOT NULL current_timestamp() —

student_enrollments

Connects students to the classes they are enrolled in (One-to-Many on both sides).

ColumnTypePKFKUniqueNullDefaultReferences
enrollment_id bigint(20) unsigned ✓ NOT NULL — —
student_id bigint(20) unsigned ✓ ✓ NOT NULL — students.student_id
class_id bigint(20) unsigned ✓ ✓ NOT NULL — classes.class_id
roll_no varchar(10) ✓ NOT NULL — —
enrollment_date date NOT NULL — —
status enum('Active','Completed','Transferred','Dropped') NOT NULL 'Active' —
created_at timestamp NOT NULL current_timestamp() —

student_parents

Junction table resolving the Many-to-Many relationship between students and parents.

ColumnTypePKFKUniqueNullDefaultReferences
student_parent_id bigint(20) unsigned ✓ NOT NULL — —
student_id bigint(20) unsigned ✓ ✓ NOT NULL — students.student_id
parent_id bigint(20) unsigned ✓ ✓ NOT NULL — parents.parent_id
relationship_type enum('Father','Mother','Guardian') NOT NULL — —
is_primary_contact tinyint(1) NOT NULL 0 —
created_at timestamp NOT NULL current_timestamp() —

subjects

Catalogue of subjects taught across the school.

ColumnTypePKFKUniqueNullDefaultReferences
subject_id bigint(20) unsigned ✓ NOT NULL — —
subject_code varchar(10) ✓ NOT NULL — —
subject_name varchar(80) NOT NULL — —
created_at timestamp NOT NULL current_timestamp() —

teachers

School teaching staff.

ColumnTypePKFKUniqueNullDefaultReferences
teacher_id bigint(20) unsigned ✓ NOT NULL — —
employee_no varchar(20) ✓ NOT NULL — —
first_name varchar(60) NOT NULL — —
last_name varchar(60) NOT NULL — —
email varchar(120) ✓ NOT NULL — —
phone varchar(20) YES NULL —
hire_date date NOT NULL — —
status enum('Active','On Leave','Resigned') NOT NULL 'Active' —
created_at timestamp NOT NULL current_timestamp() —
Explain this page
What am I looking at?
The Full Dictionary tab summarizes every column across every table in one consistent shape. The Schema SQL Viewer tab shows MySQL's own authoritative record of a table's structure — if these two ever seemed to disagree, the SQL Viewer is always correct, since it comes straight from SHOW CREATE TABLE.
یہاں کیا نظر آ رہا ہے؟
فل ڈکشنری (Full Dictionary) ٹیب ہر ٹیبل کے تمام کالمز کو ایک یکساں ترتیب میں پیش کرتا ہے۔ اسکیما ایس کیو ایل ویور (Schema SQL Viewer) ٹیب MySQL کا اپنا مستند ریکارڈ دکھاتا ہے — اگر کبھی ان دونوں میں فرق لگے، تو ایس کیو ایل ویور (SQL Viewer) ہمیشہ درست ہوگا، کیونکہ یہ براہِ راست SHOW CREATE TABLE سے آتا ہے۔