BCA / B.Tech 13 min read

What is Entity in DBMS | DBMS में एंटिटी क्या है

RK

लेखक Ratan Kumawat · संस्थापक, NotesMedia

प्रकाशित:

त्वरित सारांश और मुख्य बिंदु

  • • विषय फोकस: DBMS Notes in Hindi | डीबीएमएस नोट्स (BCA / B.Tech Syllabus)
  • • मुख्य विषय: What is Entity in DBMS | DBMS में एंटिटी क्या है - General Topics
  • • अवलोकन: Quick Answer: DBMS में Entity कोई भी real-world object (व्यक्ति, वस्तु, स्थान या concept) है, जिसका अपना स्वतंत्र अस्तित्व होता है और जिसके बारे में da...
  • • मुख्य अवधारणाएं: Entity in DBMS, DBMS entity types Hindi, Attributes ER model,
Quick Answer: DBMS में Entity कोई भी real-world object (व्यक्ति, वस्तु, स्थान या concept) है, जिसका अपना स्वतंत्र अस्तित्व होता है और जिसके बारे में database में data store किया जाता है—जैसे Student, Employee, Bank Account या Course। Entity की विशेषताओं को Attributes (जैसे Roll_No, Name, Age) कहते हैं। Relational Database में एक entity आमतौर पर table की एक row (record) होती है, और ER Diagram में इसे Rectangle (आयत) के symbol से दर्शाया जाता है।

Entity Meaning in Hindi: Entity क्या होता है?

साधारण बोलचाल में "Entity" का मतलब होता है कोई भी ऐसी चीज़ जिसका अपना अलग अस्तित्व (existence) हो। जब हम DBMS क्या है की बात करते हैं, तो database केवल खाली numbers या text store नहीं करता, बल्कि वह असली दुनिया (real world) की चीज़ों का data संभालता है।

Database Management System में Entity वह real-world object या concept है जिसके बारे में हम data इकट्ठा और store करना चाहते हैं। 1976 में Peter Chen ने जब ER Model (Entity-Relationship Model) पेश किया, तब उन्होंने Entity को database design की सबसे बुनियादी building block बनाया।

Real world में entities दो तरह की हो सकती हैं:

  • Tangible Entities (मूर्त वस्तुएं): वो चीजें जिन्हें हम देख और छू सकते हैं, जिनका physical existence होता है। Example: Student, Teacher, Laptop, Building, Doctor, Book।
  • Intangible / Conceptual Entities (अमूर्त या वैचारिक वस्तुएं): वो चीजें जो physically मौजूद नहीं होतीं, लेकिन logically उनका एक साफ़ अस्तित्व और record होता है। Example: Bank Account, Loan, Project, Course, Holiday, Order।

अगर कॉलेज के लिए software बन रहा है, तो "Student" एक entity है क्योंकि हमें student का नाम, roll number और phone number save करना है। लेकिन student की "Age" कोई entity नहीं है, वह student की एक विशेषता यानी Attribute है।

Advertisement

Entity, Entity Type और Entity Set में क्या अंतर है?

Exams में students अक्सर इन तीन terms में confuse हो जाते हैं। इन तीनों को समझना बहुत आसान है:

  1. Entity (Entity Instance): यह किसी single, specific object को बताता है। जैसे roll number 101 वाला student "Rahul" एक individual entity है।
  2. Entity Type: यह वह template, category या blueprint है जो समान attributes वाली entities के structure को define करता है। जैसे "Student" एक Entity Type है, जिसके पास Roll_No, Name और Branch जैसे attributes का structure होता है। यह database schema का हिस्सा है।
  3. Entity Set: किसी खास समय पर किसी Entity Type की सभी entities के collection (समूह) को Entity Set कहते हैं। जैसे आपकी कॉलेज में पढ़ने वाले सभी 500 students का group मिलकर "Student Entity Set" बनता है।
Entity Type (Schema / Blueprint):
STUDENT (Roll_No, Name, Branch)
                 |
                 v
Entity Set (Collection of all students in database):
+---------+----------+--------+
| Roll_No | Name     | Branch |  <-- Attributes (Columns)
+---------+----------+--------+
| 101     | Rahul    | BCA    |  <-- Entity Instance 1 (Row)
| 102     | Priya    | MCA    |  <-- Entity Instance 2 (Row)
| 103     | Amit     | B.Tech |  <-- Entity Instance 3 (Row)
+---------+----------+--------+

Relational Model के नज़रिए से समझें तो Entity Type एक Table है, Attributes उस table के Columns हैं, और Entity उस table की एक individual tuple (row) है।

Point Entity Entity Type Entity Set
मतलब एक अकेला real-world object समान objects की category / blueprint एक category के सभी objects का group
Database में क्या है Table की एक Row (Tuple) Table का Schema / Structure पूरी Table में भरा हुआ Data
Nature Data value Definition / Structure Data का collection
Example Student "Rahul" (Roll No 101) STUDENT (Roll_No, Name, Class) कॉलेज के सभी 500 Students

ER Diagram में Entity को कैसे दर्शाते हैं?

ER Diagram (Entity-Relationship Diagram) में entities, attributes और relationships को visual shapes से दिखाया जाता है। इनके standard symbols नीचे दिए गए हैं:

  • Rectangle (आयत): Strong Entity (सामान्य entity) को दर्शाता है।
  • Double Rectangle: Weak Entity को दर्शाता है।
  • Oval (दीर्घवृत्त): Attributes को दर्शाता है, जो line से अपनी entity से जुड़े होते हैं।
  • Diamond (हीरा): दो entities के बीच के Relationship को दर्शाता है।
       +--------------+
       |   Roll_No    |  (Oval - Key Attribute)
       +-------+------+
               |
        +------+------+
        |   STUDENT   |  (Rectangle - Strong Entity)
        +------+------+
               |
         +-----+----+
         |   Name   |    (Oval - Attribute)
         +----------+

Types of Entity in DBMS (Entity के प्रकार)

DBMS में business logic और database design के आधार पर entities को कई प्रकारों में बाँटा जाता है। मुख्य प्रकार नीचे detail में दिए गए हैं:

1. Strong Entity (Regular Entity)

Strong Entity वह entity है जिसका database में स्वतंत्र अस्तित्व (independent existence) होता है। इसे अपनी पहचान साबित करने के लिए किसी दूसरी entity पर निर्भर नहीं रहना पड़ता।

Strong Entity की सबसे बड़ी पहचान यह है कि इसके पास हमेशा एक Primary Key attribute होता है, जिससे इसके हर record को uniquely पहचाना जा सकता है।

  • Symbol: ER Diagram में इसे single border वाले Rectangle से बनाते हैं।
  • Example: "Employee" एक strong entity है, क्योंकि हर employee का अपना एक unique Emp_ID होता है।

2. Weak Entity

Weak Entity वह entity है जिसका अपना कोई स्वतंत्र अस्तित्व नहीं होता। यह हमेशा किसी Strong Entity (जिसे Owner Entity या Parent Entity कहते हैं) पर निर्भर करती है। अगर strong entity का record delete कर दिया जाए, तो weak entity का कोई मतलब नहीं रहता।

Weak Entity के पास अपनी कोई Primary Key नहीं होती। इसके पास सिर्फ एक Partial Key (या Discriminator) होता है। Parent entity की Primary Key और Weak entity की Partial Key दोनों को मिलाकर ही weak entity के record की पहचान होती है।

  • Symbol: इसे Double Rectangle से दिखाते हैं, और इसके relationship को Double Diamond (Identifying Relationship) से दिखाते हैं। Partial Key के नाम के नीचे dashed line (डैश वाली लाइन) खींची जाती है।
  • Example: किसी कंपनी में Employee के बच्चों या परिवार का record "Dependent" नाम की entity में रखा जाता है। Dependent एक weak entity है। अगर Employee नौकरी छोड़ दे, तो उसके Dependent के data की database में कोई ज़रूरत नहीं बचती।
+----------+          ================          ==================
| EMPLOYEE | -------- <  HAS_FAMILY  > -------- ||   DEPENDENT    ||
+----------+          ================          ==================
(Strong Entity)    (Identifying Relationship)     (Weak Entity)

3. Supertype और Subtype Entities

जब database में कुछ general entities होती हैं और उनकी कुछ specific categories भी होती हैं, तब Supertype और Subtype का इस्तेमाल होता है (यह Object-Oriented concept जैसा है):

  • Supertype Entity: एक common entity जिसमें सभी shared attributes होते हैं। जैसे "Person" (Attributes: Person_ID, Name, Address, Phone)।
  • Subtype Entity: Supertype की sub-category, जो supertype के सारे गुण inherit करती है और अपने कुछ खास extra attributes रखती है। जैसे "Student" (extra attribute: Roll_No, Fees) और "Teacher" (extra attribute: Salary, Subject)।

4. Associative Entity

जब दो Strong Entities के बीच Many-to-Many (M:N) Relationship होता है, तो Relational Database में direct table बनाना मुश्किल होता है। तब उस relationship को खुद एक entity बना दिया जाता है, जिसे Associative Entity कहते हैं।

  • इसके पास relationship की दोनों tables की Primary Keys (Foreign Keys के रूप में) होती हैं, और इसके अपने भी extra attributes हो सकते हैं।
  • Example: "Student" और "Course" के बीच "Enrolls" का Many-to-Many रिश्ता है (एक student कई courses ले सकता है, और एक course में कई students हो सकते हैं)। यहाँ Enrollment एक Associative Entity बन जाती है, जिसके पास Enrollment_Date और Grade जैसे अपने attributes होते हैं।
  • Symbol: ER Diagram में इसे Rectangle के अंदर Diamond बनाकर दर्शाया जाता है।

5. Composite Entity

Composite Entity असल में Relational Database Design में इस्तेमाल होने वाला शब्द है जो Many-to-Many relationship को तोड़ने के लिए बीच में bridge table (junction table) का काम करती है। यह Associative Entity का ही practical रूप है।

Example: ई-कॉमर्स database में "Order" और "Product" के बीच Composite Entity बनती है: OrderDetails। इसमें Order_ID और Product_ID दोनों मिलकर Composite Primary Key बनाते हैं, साथ ही Quantity और Unit_Price जैसे attributes रहते हैं।

6. Recursive Entity (Self-Referencing Entity)

जब कोई entity अपने ही प्रकार की दूसरी entity के साथ relationship बनाती है, तो उसे Recursive Entity या Self-Referencing Entity कहते हैं।

Example: "Employee" table में हर employee का एक Manager होता है। लेकिन Manager भी तो कंपनी का एक Employee ही है! यानी Employee entity का रिश्ता खुद Employee entity से ही है। इस तरह के relationship को Recursive Relationship कहते हैं।

Strong Entity vs Weak Entity: मुख्य अंतर

University exams में यह सवाल 5 marks में सबसे ज़्यादा पूछा जाता है। नीचे दोनों के बीच का अंतर साफ़ दिया गया है:

तुलना का आधार Strong Entity Weak Entity
अस्तित्व (Existence) स्वतंत्र होता है; किसी पर निर्भर नहीं Strong Entity पर पूरी तरह निर्भर होती है
Primary Key इसके पास अपनी unique Primary Key होती है अपनी Primary Key नहीं होती; Partial Key होती है
पहचान कैसे होती है सिर्फ अपनी Primary Key से Owner की Primary Key + अपनी Partial Key से
ER Diagram Symbol Single Rectangle (एकल आयत) Double Rectangle (दोहरा आयत)
Relationship Symbol Single Diamond Double Diamond (Identifying Relationship)
Participation Constraint Total या Partial दोनों हो सकता है हमेशा Total Participation होता है
Real-World Example Student, Employee, Department Dependent (आश्रित), Loan Installment
Advertisement

Worked Example: Real-World College Database Scenario

आइए एक College Management System के database scenario से समझते हैं कि Entities असल में कैसे काम करती हैं और table में कैसे बदलती हैं:

Scenario

  • कॉलेज में छात्र पढ़ते हैं: Student (Strong Entity)
  • कॉलेज में अलग-अलग branches हैं: Department (Strong Entity)
  • छात्र हॉस्टल के कमरों में रहते हैं: Hostel_Room (Weak Entity, क्योंकि हॉस्टल बंद हुआ तो रूम का कोई वजूद नहीं)
  • छात्र courses में दाखिला लेते हैं: Enrollment (Associative Entity)

Relational Tables में Entities का रूप

1. STUDENT Table (Strong Entity):

Roll_No (Primary Key) Name Phone Dept_ID (Foreign Key)
101 Vikas Sharma 9829011111 D1
102 Pooja Verma 9829022222 D1
103 Suresh Meena 9829033333 D2

2. DEPENDENT Table (Weak Entity - Employee के आश्रित):

Emp_ID (Foreign Key) Dep_Name (Partial Key) Relation Age
E501 Aarav Son 8
E501 Sneha Daughter 5
E502 Kavita Spouse 32

यहाँ ध्यान दें: Dep_Name अकेला primary key नहीं बन सकता, क्योंकि दो अलग employees के बच्चों का नाम "Aarav" हो सकता है। इसलिए Emp_ID + Dep_Name मिलकर इस record को unique बनाते हैं।

Exam में कैसे लिखें (5 Marks Answer)

अगर exam में 5 marks का question आए "What is Entity in DBMS? Explain with example", तो पूरे marks पाने के लिए point-to-point इस तरह लिखें:

  1. Definition: Entity असली दुनिया का कोई भी object या concept है जिसका स्वतंत्र अस्तित्व होता है और जिसके बारे में database में data store किया जाता है।
  2. Real-world Example: Student, Employee, Bank Account, Course आदि।
  3. ER Diagram Symbol: Strong Entity को Rectangle से और Weak Entity को Double Rectangle से दर्शाया जाता है।
  4. Attributes से जुड़ाव: Entity की विशेषताओं को Attributes कहते हैं (जैसे Student के लिए Name, Roll_No, Branch)।
  5. Entity Set: एक ही प्रकार की सभी entities के समूह को Entity Set कहते हैं (जैसे कॉलेज के सभी students)।
  6. Relational Mapping: Relational Database में Entity Type एक Table बन जाता है, और एक Entity उस Table की एक Row (Record) होती है।
  7. Strong Entity: वह entity जिसकी अपनी Primary Key होती है (जैसे Student_ID)।
  8. Weak Entity: वह entity जिसकी अपनी Primary Key नहीं होती और जो पहचान के लिए Strong Entity पर निर्भर होती है (जैसे Dependent)।
  9. Identifying Relationship: Weak Entity और Strong Entity के रिश्ते को Double Diamond से दर्शाते हैं।
  10. छोटा Diagram: Answer sheet में Student Entity का एक आयत बनाकर उसके चारों ओर Name, Roll_No के ovals ज़रूर जोड़ें।

Common Mistakes Students Make (आम गलतियाँ)

  • Entity और Attribute में confusion: कई बार students "Student_Name" या "Age" को Entity लिख देते हैं। याद रखें, Name या Age कोई स्वतंत्र object नहीं हैं; वे Student entity के गुण (Attributes) हैं।
  • Entity और Table को एक समझना: Theory exam में यह गलती बहुत होती है। Table असल में Entity Type या Entity Set को represent करती है। एक single Entity तो table की केवल एक row होती है।
  • Weak Entity में Primary Key ढूँढना: Weak entity में कभी single primary key नहीं होती। उसमें केवल Partial Key (Discriminator) होता है। Primary key हमेशा Parent Entity से उधार ली जाती है।
  • Associative Entity को भूल जाना: Many-to-Many relationship को relational model में बदलते समय direct Foreign Key लगाने की कोशिश करना गलत है। वहाँ Associative Entity (Bridge Table) बनती है।

Advantages of Entity Modeling in Database Design

Advantage फायदा क्या है
Real-World Mapping असली दुनिया के business rules को database में आसानी से समझा जा सकता है।
Clear Structure Database बनाने से पहले यह साफ़ हो जाता है कि कौन सा data कहाँ store होगा।
Redundancy Control Entity और उसके attributes साफ़ होने से duplicate data store होने से बचता है।
Easy Conversion ER Diagram में बनी entities को सीधे SQL की Tables में convert किया जा सकता है।

Exam के लिए Important Questions

Short Questions (2–3 marks)

  1. Entity क्या है? दो real-world examples दीजिए। (Entity वह real-world object है जिसका independent existence हो, जैसे Student, Car)
  2. Entity और Entity Set में क्या अंतर है? (Entity एक individual record है, Entity Set समान entities का collection है)
  3. Weak Entity क्या है? इसका ER symbol बताइए। (जो पहचान के लिए Strong Entity पर निर्भर हो; Symbol: Double Rectangle)
  4. Partial Key (Discriminator) किसे कहते हैं? (Weak entity के records में फ़र्क करने वाला attribute, जिसके नीचे dashed line होती है)
  5. Recursive Entity क्या होती है? (वह entity जो अपने ही प्रकार की entity से relationship रखे, जैसे Employee manages Employee)

Long Questions (5–10 marks)

  1. DBMS में Entity क्या है? Types of Entities को उपयुक्त examples और ER Diagram symbols के साथ detail में समझाइए।
  2. Strong Entity और Weak Entity के बीच अंतर स्पष्ट कीजिए। Weak entity के अस्तित्व के लिए identifying relationship क्यों ज़रूरी है?
  3. Entity, Attribute और Relationship को ER Diagram के ज़रिए समझाइए। Many-to-Many relationship में Associative Entity की क्या भूमिका होती है?

FAQs

Entity kya hota hai real life example ke sath?

Real life में कोई भी चीज़ जिसकी अपनी अलग पहचान हो, वह entity है। जैसे एक बैंक में "Customer" एक entity है, क्योंकि बैंक उसका नाम, पता और आधार नंबर store करता है। उसी बैंक में "Account" भी एक entity है, जिसका अपना account number और balance होता है।

What is an entity set in DBMS?

एक ही Entity Type से जुड़ी सभी individual entities के group या collection को Entity Set कहते हैं। उदाहरण के लिए, "Student" एक entity type है, लेकिन कॉलेज में पढ़ने वाले सभी 1000 छात्र मिलकर एक "Student Entity Set" कहलाते हैं।

क्या कोई Entity बिना Primary Key के exist कर सकती है?

हाँ, Weak Entity बिना अपनी Primary Key के exist कर सकती है। लेकिन database में उसकी पहचान के लिए उसे अपने owner (Strong Entity) की Primary Key की मदद लेनी पड़ती है।

DBMS में Entity और Table में क्या संबंध है?

जब हम Conceptual Design (ER Model) से Relational Database बनाते हैं, तो हर Entity Type एक Table बन जाती है, Entity के Attributes उस Table के Columns बन जाते हैं, और हर individual Entity उस Table की एक Row बन जाती है।

Supertype और Subtype Entity का क्या मतलब है?

Supertype एक general entity होती है (जैसे Person), जिसमें सभी common attributes होते हैं। Subtype उसकी specific categories होती हैं (जैसे Student, Teacher), जो supertype के attributes inherit करती हैं और अपने अलग attributes भी रखती हैं।

अक्सर पूछे जाने वाले प्रश्न (FAQs)

Quick Answer: DBMS में Entity कोई भी real-world object (व्यक्ति, वस्तु, स्थान या concept) है, जिसका अपना स्वतंत्र अस्तित्व होता है और जिसके बारे में database में data store किया जाता है—जैसे Student, Employee, Bank Account या Course।
DBMS Notes in Hindi | डीबीएमएस नोट्स के पाठ्यक्रम में What is Entity in DBMS | DBMS में एंटिटी क्या है एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको What is Entity in DBMS | DBMS में एंटिटी क्या है के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।
Advertisement