Data Model in DBMS (डेटा मॉडल क्या है?) | ER Model, ER Diagram पूरी जानकारी
परिचय (Introduction)
आज के डिजिटल युग में डेटा सबसे महत्वपूर्ण चीज़ बन चुका है। चाहे आप ऑनलाइन बैंकिंग करें, सोशल मीडिया चलाएँ, या किसी वेबसाइट से शॉपिंग करें—हर जगह डेटा का इस्तेमाल होता है।
लेकिन इतने बड़े डेटा को सही तरीके से store, manage और access करने के लिए एक structured सिस्टम की जरूरत होती है, जिसे Database System कहा जाता है।
इस database को design करने के लिए हम जिस framework का उपयोग करते हैं, उसे Data Model (डेटा मॉडल) कहा जाता है।
इस ब्लॉग में हम विस्तार से समझेंगे:
- Data Model क्या होता है
- इसके components क्या हैं
- ER Model क्या है
- ER Diagram कैसे बनाते हैं
- ER Diagram को table में कैसे convert करते हैं
👉 यह पोस्ट students, beginners और exam preparation के लिए बहुत उपयोगी है।
Data Model क्या है? (What is Data Model)
Definition:
Data Model एक ऐसा conceptual framework होता है जो यह define करता है कि database में data कैसे organize, store और manage किया जाएगा।
👉 आसान भाषा में:
Data Model database का blueprint (नक्शा) होता है।
यह तीन चीज़ों को define करता है:
- Data structure (डेटा की संरचना)
- Relationships (डेटा के बीच संबंध)
- Constraints (डेटा पर लागू नियम)
Data Model के मुख्य Components
Data Model के 3 मुख्य भाग होते हैं:
1. Structural Part (संरचनात्मक भाग)
यह database की संरचना को define करता है।
👉 इसमें शामिल होता है:
- Tables कैसे होंगे
- Fields (columns) क्या होंगे
- Data types क्या होंगे
📌 उदाहरण:
Student table → ID, Name, Age
👉 इसे database का "ढांचा" (structure) भी कहा जाता है
2. Manipulative Part (ऑपरेशन भाग)
यह बताता है कि data पर कौन-कौन से operations perform किए जा सकते हैं।
👉 इसमें शामिल होते हैं:
- Insert (नया डेटा जोड़ना)
- Update (डेटा बदलना)
- Delete (डेटा हटाना)
- Select (डेटा प्राप्त करना)
📌 ये सभी operations SQL के द्वारा किए जाते हैं
3. Integrity Rules (नियम / Constraints)
यह rules ensure करते हैं कि database में data सही और consistent रहे।
👉 इसमें शामिल होते हैं:
- Primary Key
- Foreign Key
- Unique
- NOT NULL
📌 उदाहरण:
Student ID unique होना चाहिए
ER Model क्या है? (Entity Relationship Model)
ER Model एक conceptual model है जो database design के शुरुआती चरण में उपयोग किया जाता है।
👉 इसका उपयोग होता है:
- User requirements को समझने में
- Data को diagram के रूप में दिखाने में
📌 इसे Peter Chen ने introduce किया था
ER Model के Components
ER Model के 3 मुख्य components होते हैं:
1. Entity Set (एंटिटी सेट)
Entity का मतलब होता है कोई real-world object
👉 उदाहरण:
- Student
- Teacher
- Course
📌 Representation: Rectangle (आयत)
2. Attributes (विशेषताएँ)
Attributes entity की properties होती हैं
👉 उदाहरण:
Student के attributes:
- Name
- Roll Number
- Age
Attributes के प्रकार
✔ Simple Attribute
Single value वाला
👉 जैसे: Name
✔ Composite Attribute
Multiple parts में बंटा हुआ
👉 जैसे: Full Name = First + Last
✔ Multivalued Attribute
एक से ज्यादा values
👉 जैसे: Phone Number
✔ Derived Attribute
Calculated value
👉 जैसे: Age (DOB से निकाली जाती है)
✔ Key Attribute
Unique identifier
👉 जैसे: Student ID
📌 Representation: Oval (अंडाकार)
3. Relationship Set (संबंध)
यह बताता है कि entities आपस में कैसे जुड़ी हैं
👉 उदाहरण:
Student → Course में enroll करता है
📌 Representation: Diamond (हीरे के आकार)
Relationship Types (Cardinality)
1. One-to-One (1:1)
एक entity का संबंध केवल एक entity से
👉 उदाहरण:
एक व्यक्ति → एक पासपोर्ट
2. One-to-Many (1:N)
एक entity कई entities से जुड़ी होती है
👉 उदाहरण:
एक शिक्षक → कई छात्र
3. Many-to-Many (M:N)
दोनों तरफ multiple entities
👉 उदाहरण:
Students ↔ Courses
Strong Entity और Weak Entity
Strong Entity
- अपनी primary key होती है
- independent होती है
👉 उदाहरण: Student
Weak Entity
- अपनी primary key नहीं होती
- किसी दूसरी entity पर depend करती है
👉 उदाहरण: Dependent
ER Diagram Symbols
| Component | Symbol |
|---|---|
| Entity | Rectangle |
| Attribute | Oval |
| Relationship | Diamond |
| Multivalued Attribute | Double Oval |
| Derived Attribute | Dashed Oval |
ER Diagram Example
👉 Example: Student Database
Attributes:
- Student ID
- Name
- DOB
- City
- Phone
📌 Phone = Multivalued Attribute
ER Diagram को Table में Convert करना
यह DBMS का सबसे important topic है 🔥
Rule 1: Entity → Table
हर entity को एक table में convert किया जाता है
👉 Student → Student Table
Rule 2: Attributes → Columns
Attributes table के columns बन जाते हैं
👉 Student:
- ID
- Name
- DOB
Rule 3: Multivalued Attribute
Separate table बनती है
👉 Student_Tel:
- StudentID
- Phone
Rule 4: Derived Attribute
Table में store नहीं किया जाता
👉 Age → calculate किया जाता है
Rule 5: Relationship Conversion
✔ One-to-One
Foreign key add करते हैं
✔ One-to-Many
Foreign key "many side" में जाती है
✔ Many-to-Many
नई table बनती है
👉 Student_Course:
- StudentID
- CourseID
Relationship Degree
Relationship में कितनी entities शामिल हैं:
- Unary (1 entity)
- Binary (2 entities)
- Ternary (3 entities)
Data Model के प्रकार
1. Hierarchical Model
Tree structure जैसा होता है
2. Network Model
Graph structure होता है
3. Relational Model
Table-based model (सबसे ज्यादा उपयोग होता है)
Data Model का महत्व
✔ Database design आसान बनाता है
✔ Data redundancy कम करता है
✔ Data consistency बनाए रखता है
✔ Performance improve करता है
✔ Security बढ़ाता है
Real Life Example
👉 School Database
Entities:
- Student
- Teacher
- Course
Relationships:
- Student enrolls in Course
- Teacher teaches Course
📌 ER Model से पूरा system आसानी से design किया जा सकता है
Common Mistakes
❌ Primary key define नहीं करना
❌ Multivalued attribute को direct table में डालना
❌ Relationship ignore करना
❌ Normalization ना करना
Exam & Interview Tips
✔ ER Diagram practice करें
✔ Symbols याद रखें
✔ Conversion rules समझें
✔ Real-life examples से सीखें
Conclusion
Data Model database design की foundation है। अगर आप Data Model और ER Model को अच्छे से समझ लेते हैं, तो आप आसानी से किसी भी database system को design कर सकते हैं।
इस ब्लॉग में हमने सीखा:
- Data Model basics
- ER Model
- ER Diagram
- Conversion rules
💬 Leave a Comment & Rating