E/R model: Entity, Relationship, Attribute

E/R model एक database को तीन building blocks से design करता है: entities वे चीज़ें हैं जिन्हें आप store करते हैं (Customer, Item), attributes उनके ब्योरे हैं (name, price), और relationships वे क्रियाएँ हैं जो उन्हें जोड़ती हैं (एक customer एक item ख़रीदता है)।

10 min read · 9 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

बनाने से पहले design

Meera का भतीजा उसकी दुकान का database बनाने वाला है। एक अच्छा builder ईंटें बेतरतीब नहीं रखता, वह पहले एक plan खींचता है।

Databases के लिए, वह plan एक E/R diagram है, और यह बस तीन तरह के टुकड़ों से बना है: वे चीज़ें जिन्हें आप store करते हैं, उनके ब्योरे, और वे कैसे जुड़ते हैं। इन तीनों को कागज़ पर सही कर लीजिए और tables लगभग खुद लिख जाती हैं।

और इन्हें ढूँढने का एक प्यारा shortcut है: वे business का वर्णन करते एक साधारण अंग्रेज़ी वाक्य के अंदर छिपे होते हैं।

Theory

आपके business के nouns और verbs

Meera की दुकान को एक वाक्य में वर्णन कीजिए: "एक customer एक order देता है items के लिए।" व्याकरण ने अभी आपको design थमा दिया। Nouns (customer, order, item) entities हैं, वे चीज़ें जिन्हें आप store करते हैं। जो ब्योरे आप जोड़ेंगे ('customer का name, item की price') attributes हैं। Verb ('देता है') relationship है। E/R design बड़े पैमाने पर एक सादे वर्णन में से nouns और verbs पढ़ना है।

At a glance

तीन E/R building blocks

Elementहैआकार / बनता है
Entityएक चीज़ जिसे आप store करते हैं (Customer)Rectangle / एक table
Attributeएक ब्योरा (name, price)Ellipse / एक column
Relationshipएक association (BUYS)Diamond / एक link

Theory

तीनों, ठीक-ठीक

  • Entity: एक असली-दुनिया की चीज़ जिसके बारे में आप data रखते हैं, Customer, Item, Order। एक rectangle के रूप में खींची। हर entity एक table बनती है।
  • Attribute: एक entity का गुण, एक Customer का name और phone, एक Item की price। एक ellipse के रूप में खींचा। हर attribute एक column बनता है।
  • Relationship: entities के बीच एक association, आम तौर पर एक verb: Customer ख़रीदता है Item, Customer देता है Order। एक diamond के रूप में खींची।

ध्यान दीजिए: entity to table, attribute to column ठीक Meera की spreadsheet है (items rows में नीचे, ब्योरे columns में आर-पार), अब एक ढंग की design शब्दावली के साथ।

Quiz

'एक customer एक order देता है' में, कौन सा शब्द RELATIONSHIP है?

  1. देता है (दोनों entities को जोड़ता verb)
  2. customer
  3. order
  4. एक
Show the answer

देता है (दोनों entities को जोड़ता verb)

देता है दोनों entities (Customer और Order) को जोड़ता verb है, तो यह relationship है, एक diamond के रूप में खींची। 'Customer' और 'order' entities हैं (nouns, rectangles के रूप में खींची)। noun-बनाम-verb heuristic, nouns entities/attributes बनते हैं, verbs relationships बनते हैं, एक वर्णन में से एक E/R design पढ़ने का सबसे तेज़ तरीका है।

Think first

Entity या attribute?

Meera की दुकान में, क्या 'phone number' एक ENTITY है या एक ATTRIBUTE? और 'Supplier' का क्या? वह test बताइए जो आपने तय करने को इस्तेमाल किया।

Show the answer

'Phone number' एक attribute है (एक customer का ब्योरा, एक ellipse के रूप में खींचा, एक column बनता है)। 'Supplier' एक entity है (अपने ख़ुद के ब्योरे जैसे name और address वाली एक चीज़, एक rectangle के रूप में खींची, एक table बनती है)। Test: क्या यह अपने ख़ुद के गुणों के साथ अकेला खड़ा हो सकता है? अगर हाँ, entity; अगर यह बस किसी और चीज़ का वर्णन करता ब्योरा है, attribute। यह entity-बनाम-attribute परख E/R design का मूल कौशल है।

Watch out

Marks कहाँ कटते हैं

आकार गड्डमड्ड करना: entity = rectangle, attribute = ellipse, relationship = diamond, exams सही symbols के marks देते हैं। एक entity (एक अकेली चीज़, एक table बनती है) को एक attribute (एक ब्योरा, एक column बनता है) से गड्डमड्ड करना। और यह भूलना कि relationships आम तौर पर verbs हैं। जब एक paragraph से 'entities, attributes और relationships पहचानिए' कहा जाए, पहले nouns और verbs को underline कीजिए, यह भरोसेमंद तरीका है।

Theory

यह blueprint वाला चरण है

हर असली database project यहीं से शुरू होता है: client से बात करो, business को वाक्यों में लिखो, entities, attributes और relationships निकालो, E/R diagram खींचो, फिर tables बनाओ। इसे छोड़ो और आपको Meera की उलझी spreadsheet मिलती है। आपके BCA project में, एक E/R diagram अक्सर एक ज़रूरी deliverable होता है। अगला lesson relationships में महत्वपूर्ण ब्योरा जोड़ता है: कितने, one-to-one, one-to-many, many-to-many (cardinality)।

Summary

Key takeaways

  • E/R model एक database को बनाने से पहले तीन blocks से design करता है।
  • Entity: एक चीज़ जिसे आप store करते हैं (Customer, Item), एक rectangle के रूप में खींची, एक table बनती है।
  • Attribute: एक entity का ब्योरा (name, price), एक ellipse के रूप में खींचा, एक column बनता है।
  • Relationship: entities के बीच एक association (BUYS, देता है), एक diamond के रूप में खींची, आम तौर पर एक verb।
  • Heuristic: nouns entities/attributes बनते हैं, verbs relationships बनते हैं।
  • याद रखने का hook: अपने business के nouns और verbs ज़ोर से पढ़िए।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Concepts of Database

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

E/R model: Entity, Relationship, Attribute · Data Processing and Analysis (DPA) · Gri-Learn