ER Model :-
एक ऐसा model जो किसी system के डाटा को entity एवं relationship के set के द्वारा represent करता है उसे ER model कहते हैं|
एक entity को physical object या conceptual object हो सकती है जो किसी वस्तु यह व्यक्ति अथवा विचार को represent करता है|
Components of Entity Relationship Model (ER Model):-
ER Model के तीन प्रमुख component होते हैं जिन्हें ER diagram में डिफरेंट किया जाता है|
- Entities
- Relationship
- Attributes
- Entities
एक entity कोई भी person, place और real-world object हो सकता है| जिसे as customer_id, customer_name and customer_city etc. Attributes जिन्हें customer entity में define किया जाता है|
ER Diagram में entity को rectangle के द्वारा denote किया जाता है|
Entity Set :-
Entity Set एक ही प्रकार के entities का एक collection है जो same property शेयर करता है|
Types of Entity : –
DBMS ने entity निम्नलिखित प्रकार की होती है –
1. Weak Entity
Weak entity एक ऐसी प्रकार की entity होती है जो अपनी attributes के द्वारा uniquely identify नहीं हो पाती है हम कह सकते हैं कि primary key नहीं होती है|
2. Strong Entity
वह entity जिनके पास primary key होता है, strong entity कहलाती है| यह यूनिक uniquely identify की जा सकती है|
- Relationship
यह diagram में relationship entities के मध्य relation को दर्शाता है| Relationship को diamond के द्वारा denote किया जाता है|

Degree of Relationship :-
Relation three types की होती हैं –
1. Binary :-
अगर Relationship type की degree 2 होती है तो उसे binary कहते हैं|
[binary = degree 2]
2. Ternary :-
अगर Relationship type की degree 3 होती है तो उसे ternary कहते हैं|
[binary = degree 3]
3. N – ary :-
अगर Relationship type की degree N होती है तो उसे N – ary कहते हैं|
[N – ary = degree n]
- Attribute :- एक attribute entity की property होती है| जोकि अन्य Entities से different होती है और वो Entity के बारे में सूचना provide करता है|
वो attributes जो entity को identify करते हैं उन्हें key attribute कहते हैं| और वो attributes जो entity को describe करते हैं उन्हें non-key attribute कहते हैं|
Attributes को ellipse(O) के द्वारा represent किया जाता है|
Types of Attribute :-
DBMS में attributes निम्नलिखित प्रकार के होते हैं :-
1. Simple and composite attribute :
जो simple attribute होते हैं sub part में वो divide नहीं होते हैं| जबकि composite attribute sub part में divide हो जाते हैं|
As Name attribute first name एंड last name में divide हो जाता है जहां name एक composite attribute है and first name एंड last name सिंपल simple attribute है|
2. Single value and multi value :
वह attribute जिसके पास किसी विशेष entity के लिए केवल एक ही value होती है single value attribute कहलाती है| As किसी व्यक्ति की age एक single value attribute है
वह attribute जिसके पास एक entity के लिए बहुत सारी value होती हैं multi-value attribute कहलाती है|
As – किसी कार्य के लिए color and employee का phone no.
3. Stored and derived Attribute :-
इस प्रकार के attribute की value को दूसरे related attribute की value से derived किया जाता है|
As – किसी Person के age को उसके birth date से derived किया जाता है| Age एक derived attribute है तथा birth date एक stored attribute है|
Entity Relationship diagram :
ER diagram का use entity के relations को दर्शाने के लिए करते हैं|
1. Rectangle (entity)
2. Double Rectangle (weak attribute)
3. Diamond
4. Ellipse
Key :
किसी भी record की फील्ड unique value बनाने के लिए keys का use किया जाता है| Relational DBMS acetate Addressing का use करता है अर्थात यह rows को value के द्वारा Identify तथा locate करता है user के लिए physical address पारदर्शी होना चाहिए इसलिए relational system में keys की need होती है जो relational DB में table की rows को unique form से identify कर सकती है|
Types of Keys :
- Primary Key
- Candidate Key
- Composite Key
- Super Key
- Foreign Key
1. Primary Key :
Primary Key एक table में प्रत्येक record को unique रखने के लिए use की जाती है| इस key के attribute कभी भी change नहीं होना चाहिए जैसे कि व्यक्ति का address primary key का part नहीं होना चाहिए क्योंकि यह change हो सकता है but employee code नहीं change किया जा सकता जब तक की व्यक्ति उस organization को ना छोड़ दे|
Primary key किसी भी table में unique key होती है जो पूरे record को denote करती है|
2. Candidate Key :
Candidate Key, attribute का set या एक attribute होता है जो एक record को unique रखने के लिए use की जाती है| यह attribute candidate key की कहलाते है|
इस तरह के case में candidate key में से एक key को primary key चुन लिया जाता है तथा शेष बचे हुए candidate key या alternate key कहलाती है|
3. Composite Key :
कई case में जब हम DB design करते हैं तो हम table बनाते है प्रत्येक table में हम एक से अधिक column के part को primary key की तरह use करते हैं उन्हें composite key कहते है|
दूसरे शब्दों में जब एक record एक single field के द्वारा uniquely identify नहीं किया जा सकता है तो ऐसे case में composite key का use किया जाता है
4. Super key :
एक super key एक entity के लिए एक या एक से अधिक attribute का set होता है| जिसकी combine value entity set में entity को unique बनाती है एक entity set employee में attribute का set employee name, address, contact number etc को एक super key की तरह use किया जा सकता है| 5. Foreign Key : Foreign key का यूज़ एक table क दूसरी table के साथ relationship को स्थापित (stablish) करने के लिए किया जाता है| अर्थात एक table की link दूसरे table के साथ बनाने के लिए किया जाता है|