Database Map
Every box is a table. Every arrow is a Foreign Key, drawn from the "many" side back to the "one" side it points at. Click a table name to jump straight to its full structure in the Table Explorer.
اس ڈایاگرام میں ہر باکس ایک ٹیبل (Table) ہے۔ ہر تیر کا نشان ایک فارن کی (Foreign Key) کو ظاہر کرتا ہے، جو "مینی" یعنی چائلڈ ٹیبل (Child Table) سے نکل کر "ون" یعنی پیرنٹ ٹیبل (Parent Table) کی طرف اشارہ کرتا ہے۔ کسی بھی ٹیبل کے نام پر کلک کر کے آپ ٹیبل ایکسپلورر (Table Explorer) میں اس کی مکمل ساخت دیکھ سکتے ہیں۔
Two junction tables, two different shapes
student_parents resolves a true Many-to-Many:
one student can have several parents, one parent can have several children. It has exactly
two Foreign Keys.
class_subject_teachers is a 3-way assignment table:
it connects three parents at once (class, subject, teacher) to answer one specific question —
who teaches what, where.
Why isn't there a 1:1 relationship here?
This schema doesn't need one — every real-world link here genuinely repeats (a student has many enrollments over time, an invoice gets many payments). A 1:1 would appear if, say, each student had exactly one extended profile row kept in a separate table purely to keep a wide, rarely-used set of columns out of the main table. That's a real pattern, just not one this schema's data called for.
Explain this page
- What am I looking at?
- Every table in
school_learning_lab, drawn as a box, with arrows showing which Foreign Key points at which Primary Key. Solid grey arrows are ordinary 1:M relationships; dashed plum arrows mark the Many-to-Many path through a junction table. - How do I read an arrow?
- An arrow always starts at the "many" (child) table and points at the "one" (parent) table — because the child holds the Foreign Key column, and that column's value must match a row that already exists on the parent side.
- What could go wrong?
- Removing a row on the arrow's target end while child rows still point at it — that's exactly what Foreign Keys are built to prevent. Try it yourself in the Keys & Constraints Lab.
- یہاں کیا نظر آ رہا ہے؟
school_learning_labکے تمام ٹیبلز (Tables) باکسوں کی شکل میں دکھائے گئے ہیں، اور تیر کے نشانوں سے ظاہر کیا گیا ہے کہ کون سی فارن کی (Foreign Key) کس پرائمری کی (Primary Key) کی طرف اشارہ کر رہی ہے۔ گہرے بھورے ٹھوس تیر عام ون-ٹو-مینی (1:M) تعلق کو ظاہر کرتے ہیں، جبکہ بنفشی رنگ کے نقطہ دار تیر جنکشن ٹیبل (Junction Table) کے ذریعے مینی-ٹو-مینی (Many-to-Many) راستے کو نشان زد کرتے ہیں۔- تیر کو کیسے پڑھیں؟
- تیر ہمیشہ "مینی" یعنی چائلڈ ٹیبل (Child Table) سے شروع ہو کر "ون" یعنی پیرنٹ ٹیبل (Parent Table) کی طرف اشارہ کرتا ہے — کیونکہ فارن کی کا کالم (Column) چائلڈ ٹیبل میں ہوتا ہے، اور اس کی قدر پیرنٹ ٹیبل کی کسی موجود قطار سے مطابقت رکھنا ضروری ہے۔
- کیا غلط ہو سکتا ہے؟
- جب تیر کے نشانہ (پیرنٹ) ٹیبل سے کوئی ریکارڈ حذف کیا جائے جبکہ چائلڈ ٹیبل کے ریکارڈز اب بھی اس کی طرف اشارہ کر رہے ہوں — یہی وہ صورت ہے جسے فارن کی (Foreign Key) روکنے کے لیے بنائی گئی ہے۔ اسے خود آزمائیں: Keys & Constraints Lab۔