Related Topics

Related Subjects

Keys in ER Model in Hindi

RGPV University / DIPLOMA_CSE / DBMS

Keys in ER Model in Hindi

What are Keys in ER Model in Hindi

जब हम **ER Model (Entity Relationship Model)** की बात करते हैं, तो Keys एक बहुत ही ज़रूरी हिस्सा होती हैं। Keys वो attributes होते हैं जो हर entity को uniquely पहचानने में मदद करते हैं। यानी कि अगर हमारे पास 100 students की list है, तो हर एक student को uniquely पहचानने के लिए हमें एक ऐसा field चाहिए जो हर student के लिए अलग हो – जैसे कि Roll Number। ये Roll Number एक Key कहलाती है।

Why Keys are Important in Hindi

Keys इसलिए important हैं क्योंकि ये हमें help करती हैं:
  • हर entity को uniquely पहचानने में
  • Database में redundancy कम करने में
  • Tables के बीच relationships establish करने में
  • Data consistency और accuracy maintain करने में

Types of Keys in ER Model in Hindi

ER Model में कई प्रकार की Keys होती हैं। चलिए हर एक को सरल भाषा में समझते हैं:
  • Super Key: कोई भी ऐसा attribute या attribute का combination जो entity को uniquely पहचान सके। जैसे – Roll Number अकेले या (Roll Number + Name)।
  • Candidate Key: वो minimal Super Key जिसमें कोई भी extra attribute नहीं होता। जैसे केवल Roll Number।
  • Primary Key: Candidate Key में से चुनी गई एक Key जो entity को uniquely पहचानती है।
  • Alternate Key: बाकी बची हुई Candidate Keys जो Primary Key नहीं बनी।
  • Composite Key: जब एक से ज़्यादा attributes को जोड़कर unique identity बनती है। जैसे (Course ID + Student ID)।
  • Foreign Key: एक table की वो field जो किसी दूसरे table की Primary Key को refer करती है। ये tables के बीच relationship बनाता है।

How to Choose the Right Key in Hindi

Right Key चुनने के लिए कुछ जरूरी points का ध्यान रखना चाहिए:
  • ऐसा attribute चुनें जो हर record को uniquely पहचान सके।
  • Key को stable और rarely changing attribute के रूप में चुनें, जैसे Aadhar Number या Employee ID।
  • Key जितनी short और simple होगी, उतना बेहतर होगा performance के लिए।
  • डेटा duplication और inconsistency से बचाने में मदद करने वाली Key को प्राथमिकता दें।

Examples of Keys in ER Model in Hindi

| Entity | Super Key | Candidate Key | Primary Key | Alternate Key | Composite Key | Foreign Key | |--------|-----------|---------------|-------------|---------------|----------------|--------------| | Student | Roll Number, (Roll Number + Name) | Roll Number | Roll Number | Admission Number | (Student ID + Course ID) | Department ID | | Employee | Employee ID, (Employee ID + Name) | Employee ID | Employee ID | Email ID | (Department ID + Emp ID) | Manager ID | इस table से आप समझ सकते हैं कि कैसे अलग-अलग Keys एक entity के साथ जुड़ी होती हैं और क्या role निभाती हैं।

Advantages of Using Keys in ER Model in Hindi

  • Keys से data को logically organize करना आसान होता है।
  • Data redundancy कम होती है क्योंकि हर entity uniquely define होती है।
  • Entities के बीच relation बनाने में Keys एक strong foundation provide करती हैं।
  • Data integrity बनी रहती है – यानी गलत या duplicate डेटा को रोका जा सकता है।
  • Querying, indexing और searching performance बेहतर होती है।

Limitations of Keys in ER Model in Hindi

  • अगर Primary Key बार-बार बदलती है, तो Referential Integrity टूट सकती है।
  • Composite Keys complex हो सकती हैं, जिससे table design और queries complicated हो जाती हैं।
  • Foreign Keys की dependency की वजह से data insert/update/delete करते समय constraints का ध्यान रखना पड़ता है।
  • कुछ cases में unique key ढूंढना मुश्किल हो सकता है, जैसे कि पुराने documents में।

Types of Keys in ER Model in Hindi

What are the Different Types of Keys in ER Model in Hindi

जब हम **ER Model (Entity Relationship Model)** डिज़ाइन करते हैं, तो उसमें अलग-अलग तरह की **Keys** का बहुत बड़ा रोल होता है। हर Key का एक unique purpose होता है और ये पूरे Database के structure को सही तरह से organize करने में मदद करती हैं। अब मैं तुम्हें एकदम आसान भाषा में, एक अच्छे दोस्त और टीचर की तरह समझाऊँगा कि कितने प्रकार की Keys होती हैं, और वो क्या करती हैं।

1. Super Key in Hindi

**Super Key** वह attribute या attribute का combination होता है जो किसी entity को uniquely पहचानने की क्षमता रखता है।
  • ये ज़रूरी नहीं कि वो minimal हो, बस unique पहचान देनी चाहिए।
  • Example: अगर Student Table है, तो Roll Number या (Roll Number + Name) दोनों Super Key हो सकते हैं।

2. Candidate Key in Hindi

**Candidate Key** वो minimal Super Key होती है जिसमें कोई भी extra attribute शामिल नहीं होता।
  • ये सबसे short और meaningful key होती है जो uniquely identify कर सके।
  • Example: सिर्फ Roll Number ही Candidate Key मानी जाएगी, क्योंकि इसमें कोई extra field नहीं है।

3. Primary Key in Hindi

**Primary Key** Candidate Keys में से चुनी गई वो Key होती है जिसका इस्तेमाल entity को uniquely identify करने के लिए किया जाता है।
  • Table में सिर्फ एक ही Primary Key हो सकती है।
  • इसमें NULL value allowed नहीं होती और हमेशा unique होनी चाहिए।
  • Example: Roll Number को Primary Key बनाया जा सकता है।

4. Alternate Key in Hindi

**Alternate Key** वो Candidate Keys होती हैं जो Primary Key नहीं बनीं।
  • अगर आपके पास एक से अधिक Candidate Keys हैं, तो जो Primary नहीं बनी, वो Alternate Keys कहलाती हैं।
  • Example: अगर Roll Number को Primary Key बना दिया और Admission Number भी unique था, तो Admission Number Alternate Key होगी।

5. Composite Key in Hindi

**Composite Key** वो Key होती है जो एक से अधिक attributes को combine करके बनती है।
  • जब एक attribute entity को uniquely identify नहीं कर पाता, तब दो या अधिक attributes को मिलाकर Composite Key बनाई जाती है।
  • Example: (Student ID + Course ID) एक Composite Key हो सकती है जो uniquely बताती है कि कौन सा student किस course में enrolled है।

6. Foreign Key in Hindi

**Foreign Key** वो attribute होता है जो एक table की Primary Key को किसी दूसरे table में refer करता है।
  • ये दो tables के बीच relationship बनाता है।
  • Foreign Key में NULL values हो सकती हैं।
  • Example: एक Student Table में Department ID एक Foreign Key हो सकती है जो Department Table की Primary Key को refer करती है।

Comparison Table of Keys in Hindi

Key Type Description (in Hindi) Example
Super Key Entity को uniquely पहचानने वाला कोई भी attribute या attributes का समूह Roll Number, (Roll Number + Name)
Candidate Key Minimal Super Key जिसमें कोई extra field न हो Roll Number
Primary Key Candidate Keys में से चुनी गई Key जो record को uniquely identify करती है Roll Number
Alternate Key जो Candidate Key Primary Key नहीं बनी Admission Number
Composite Key दो या अधिक attributes को मिलाकर बनाई गई Key (Student ID + Course ID)
Foreign Key किसी दूसरे table की Primary Key को refer करने वाली Key Department ID

Importance of Keys in ER Model in Hindi

Why Keys are Important in ER Model in Hindi

जब हम **ER Model (Entity Relationship Model)** बनाते हैं, तो उसमें **Keys** की भूमिका बिल्कुल उसी तरह होती है जैसे किसी इंसान की पहचान के लिए उसका नाम या ID. Keys हमें यह तय करने में मदद करती हैं कि कोई भी data entry यूनिक है या नहीं, यानी कि वह database में एक distinct entity को represent करती है। अब चलो इसे step by step और बड़े आसान भाषा में समझते हैं कि ये Keys इतनी ज़रूरी क्यों होती हैं:

Main Roles of Keys in Hindi

  • Uniqueness सुनिश्चित करना: Keys हर entity को uniquely पहचानने में मदद करती हैं। इसका मतलब यह है कि कोई भी दो records same नहीं होंगे, जिससे confusion और duplication से बचा जा सकता है।
  • Entity की पहचान बनाना: किसी भी table में Keys की वजह से ही हम बता पाते हैं कि कौन सा row किस entity को represent कर रहा है। जैसे Student Table में Roll Number एक Key है जो हर छात्र को uniquely पहचानता है।
  • Relationships बनाने में मदद: Keys दो tables के बीच relation बनाने में bridge का काम करती हैं। जैसे Foreign Key, एक table को दूसरे table से जोड़ती है, जिससे complex database models बनाना आसान हो जाता है।
  • Data Integrity बनाए रखना: Keys से database में consistency बनी रहती है। मतलब अगर एक entity पहले से मौजूद है, तो वही दोबारा duplicate होकर नहीं आएगी।
  • Query Execution बेहतर बनाना: जब database में Keys होती हैं तो searching, sorting, indexing और querying ज़्यादा तेज़ और accurate होती है।

Use of Different Keys in Ensuring Data Accuracy in Hindi

Key Type Usefulness (in Hindi)
Primary Key हर entity को uniquely पहचानने के लिए उपयोग की जाती है। इससे duplicate records नहीं आते।
Foreign Key दो tables के बीच strong relationship बनाने के लिए काम आती है। ये Referential Integrity को maintain करती है।
Composite Key जब एक attribute से entity uniquely identify न हो पाए, तब Composite Key से data consistency बनी रहती है।
Alternate Key Backup Key के तौर पर काम करती है जब Primary Key किसी कारण से use न हो सके।

Benefits of Keys for Students Learning Database in Hindi

  • Keys concept को अच्छे से समझने पर data को organize करना बहुत आसान हो जाता है।
  • Keys SQL queries में Primary Key और Foreign Key constraints के logic को समझने में मदद करती हैं।
  • Exam में theoretical और practical दोनों questions में Keys सबसे ज़्यादा पूछे जाने वाले टॉपिक्स में से एक होती हैं।
  • Projects बनाते समय Keys से data linking और structure सही रहता है जिससे logic implement करना आसान होता है।

Real-Life Example of Key Importance in Hindi

मान लीजिए कि एक कॉलेज का database है जिसमें दो tables हैं – `Students` और `Departments`। अब:
  • Students Table: इसमें हर student को पहचानने के लिए Roll Number को Primary Key बनाया गया है।
  • Departments Table: इसमें हर department को पहचानने के लिए Dept_ID है जो Primary Key है।
  • Students Table में Dept_ID को Foreign Key बनाया गया है जो Departments Table से connect होता है।
इस structure से ये सुनिश्चित होता है कि कोई भी student किसी valid department से ही जुड़ा हो। यानी कि data बिल्कुल accurate और logically correct रहेगा।

How to Choose the Right Key in Hindi

Best Practices to Choose the Right Key in Hindi

जब आप एक **ER Model (Entity Relationship Model)** डिज़ाइन कर रहे होते हैं, तब सबसे ज़रूरी स्टेप होता है – "सही Key को चुनना।" ये एकदम वैसा है जैसे किसी building के लिए strong foundation चुनना। अगर आपने सही Key नहीं चुनी, तो आपके पूरे database का structure कमजोर पड़ सकता है। चलिए एक टीचर की तरह और दोस्ताना अंदाज़ में समझते हैं कि कैसे हम सही Key का चुनाव कर सकते हैं, और किन बातों का ध्यान रखना चाहिए।

Important Points to Consider While Choosing the Key in Hindi

  • Uniqueness होनी चाहिए: जिस Key को आप चुन रहे हैं, वो हर entity को uniquely पहचान सके। अगर दो rows में एक ही value हो, तो वो Key काम की नहीं होगी।
  • Non-nullable होनी चाहिए: Ideal Primary Key कभी भी NULL नहीं होनी चाहिए। अगर कोई attribute ऐसा है जिसमें कभी-कभी value missing हो जाती है, तो उसे Key मत बनाओ।
  • Stable होना ज़रूरी है: जिस attribute को आप Key बना रहे हैं वो future में change न हो। जैसे Name या Mobile Number को Key मत बनाओ, क्योंकि ये बदल सकते हैं।
  • Minimal होना चाहिए: जितना कम attribute, उतना बेहतर। कोशिश करो कि एक single attribute से काम चल जाए। ज़रूरत पड़े तो ही Composite Key यूज़ करें।
  • Indexed होना चाहिए: अगर वो Key attribute indexed है या future में index किया जा सकता है, तो query performance तेज़ होगी।

Types of Keys and When to Use Them in Hindi

Key Type Use When Avoid When
Primary Key जब आपके पास ऐसा attribute हो जो unique और non-null हो जब data बदलने की संभावना हो
Composite Key जब एक attribute से entity uniquely identify न हो पा रही हो जब बहुत सारे fields को combine करना पड़े
Surrogate Key जब कोई natural key available न हो जब business logic के लिए natural key ज़रूरी हो
Foreign Key जब दो tables को logically connect करना हो जब दोनों tables का संबंध न हो

Step-by-Step Guide to Select the Right Key in Hindi

  • Step 1: सारे attributes को observe करें और देखें कौन-कौन से fields unique values रखते हैं।
  • Step 2: देखिए कि उन attributes में NULL values तो नहीं आतीं।
  • Step 3: उनमें से ऐसा attribute चुनिए जो कभी future में change न हो (जैसे Aadhar Number)।
  • Step 4: अगर कोई single attribute नहीं मिल रहा, तो दो या तीन को combine करके Composite Key बना सकते हैं।
  • Step 5: अब अगर natural attribute available नहीं है, तो एक Surrogate Key (जैसे Auto-increment ID) बना सकते हैं।
  • Step 6: फिर देखें कि किस table को दूसरे table से जोड़ना है, और वहाँ Foreign Key set करें।

Real-Life Example in Hindi

मान लीजिए आपके पास एक `Students` Table है, जिसमें निम्न attributes हैं: Name, Email, Phone Number, Roll Number. अब इनमें से:
  • Name: Unique नहीं होगा, इसलिए इसे छोड़ दें।
  • Email: ज़्यादातर cases में unique होता है, लेकिन future में change हो सकता है।
  • Phone Number: change होने की संभावना ज़्यादा है।
  • Roll Number: ये हमेशा unique, non-null और stable होता है।
👉 तो यहाँ सबसे सही Key होगी: **Roll Number** (as Primary Key)

Examples of Keys in ER Model in Hindi

Real-Life Examples of Keys in ER Model in Hindi

जब हम **ER Model (Entity Relationship Model)** डिज़ाइन करते हैं, तो उसमें सही और practical examples समझना बहुत ज़रूरी होता है। एक teacher की तरह मैं आपको ऐसे daily life examples के ज़रिए समझाने वाला हूँ, जो आपके concepts को crystal clear कर देंगे। यहाँ हम हर प्रकार की **Key** के साथ उसके practical example को detail में explain करेंगे ताकि आप theoretical नहीं, practically सोच सकें।

Primary Key Examples in Hindi

  • Student Table: मान लीजिए आपके पास एक `Students` टेबल है, जिसमें fields हैं - Student_ID, Name, Email. यहाँ `Student_ID` एक unique और non-null attribute है। इसलिए इसे Primary Key बनाया जाता है।
  • Employee Table: एक `Employees` टेबल में Emp_ID, Name और Phone_Number हो सकते हैं। यहाँ पर Emp_ID एक ऐसा attribute है जो हर employee के लिए unique है, इसलिए यह Primary Key होगा।

Candidate Key Examples in Hindi

  • मान लीजिए एक `Users` टेबल है जिसमें तीन attributes हैं: User_ID, Email, और Phone_Number. अब तीनों में से हर एक unique है, तो तीनों ही Candidate Keys हैं। लेकिन आप इन तीनों में से एक को Primary Key चुनेंगे (जैसे User_ID), बाकी दो Alternate Keys कहलाएँगे।

Composite Key Examples in Hindi

  • Course_Enrollment Table: एक टेबल है जिसमें Student_ID और Course_ID है। एक ही student multiple courses कर सकता है, और एक ही course में कई students हो सकते हैं। तो यहाँ `Student_ID + Course_ID` मिलकर Composite Key बनाते हैं ताकि एक enrollment uniquely identify हो सके।

Foreign Key Examples in Hindi

  • Orders Table: मान लीजिए `Customers` टेबल में Customer_ID Primary Key है। अब `Orders` टेबल में Customer_ID as Foreign Key use होती है ताकि ये पता चल सके कि कौन-सा order किस customer से related है।

Super Key Examples in Hindi

  • Bank Account Table: अगर एक टेबल में Account_Number, IFSC_Code, और Customer_ID है, तो नीचे दिए गए तीनों Super Keys हो सकते हैं:
    • Account_Number
    • Account_Number + IFSC_Code
    • Account_Number + Customer_ID
    लेकिन इन तीनों में से सबसे minimal को Candidate Key माना जाएगा।

All Key Types with Examples in Hindi (Table Format)

Key Type Example Table Attribute(s) Role
Primary Key Students Student_ID Unique Identification
Candidate Key Users User_ID, Email Multiple Unique Choices
Composite Key Course_Enrollment Student_ID + Course_ID Combined Key
Foreign Key Orders Customer_ID Reference to Another Table
Super Key Bank_Accounts Account_Number, Account_Number + IFSC_Code All Unique Combinations

Code Example in Hindi

नीचे एक simple database schema का SQL code दिया गया है, जिसमें Primary और Foreign Keys को define किया गया है: CREATE TABLE Students ( Student_ID INT PRIMARY KEY, Name VARCHAR(100), Email VARCHAR(100) ); CREATE TABLE Course_Enrollment ( Student_ID INT, Course_ID INT, PRIMARY KEY (Student_ID, Course_ID), FOREIGN KEY (Student_ID) REFERENCES Students(Student_ID) );

Advantages of Using Keys in ER Model in Hindi

What are the Advantages of Keys in ER Model in Hindi

जब हम किसी भी database को design करते हैं, तो उसमें data को सही ढंग से organize और identify करना सबसे ज़्यादा important होता है। अब ज़रा सोचिए, अगर आपके पास हज़ारों records हैं और आपको किसी एक student या customer की detail निकालनी हो—तो कैसे करेंगे? यही काम आसान बनाते हैं **Keys**। **Keys** ER Model का ऐसा हिस्सा हैं जो किसी भी entity को uniquely identify करने में मदद करते हैं और data integrity बनाए रखते हैं। चलिए world's best teacher की तरह समझते हैं कि Keys के क्या-क्या फायदे होते हैं।

Main Advantages of Using Keys in ER Model in Hindi

  • Unique Identification: Keys का सबसे बड़ा फायदा यही है कि ये हर entity instance को uniquely identify करते हैं। जैसे अगर Student_ID Primary Key है, तो हर student का unique ID होगा जिससे confusion नहीं होगा।
  • Data Integrity को बनाए रखना: Keys ensure करती हैं कि data duplicate न हो और system में consistency बनी रहे। जैसे एक ही Email ID दो बार ना हो सके, ये Candidate Key के through संभव होता है।
  • Relation Establish करना: **Foreign Keys** की मदद से हम दो entities के बीच relation establish कर सकते हैं। जैसे Customer और Orders के बीच, जिससे normalized और relational database structure possible होता है।
  • Data Retrieval Fast बनाना: Keys की वजह से queries तेज़ी से execute होती हैं, क्योंकि database को पता होता है कि search कहाँ करना है। इससे performance बेहतर होती है और large scale applications में बहुत मदद मिलती है।
  • Referential Integrity Maintain करना: Foreign Keys ये सुनिश्चित करती हैं कि कोई भी invalid reference न रहे। जैसे कोई ऐसा order न हो, जिसका customer system में मौजूद ही नहीं है।
  • Duplicate Data Avoid करना: Keys database में redundancy को रोकती हैं। इससे storage बचता है और errors कम होते हैं। Primary और Candidate Keys इस काम में विशेष रूप से useful होती हैं।
  • Data Sorting और Filtering आसान बनती है: जब हर row का एक unique key होता है, तो उसे आसानी से sort या filter किया जा सकता है। जैसे – Name के बजाय Roll Number से sort करना तेज़ और सही होता है।
  • Normalization में Help करना: Keys database को normalize करने में मदद करती हैं, जिससे data logical और non-redundant form में store होता है। जैसे composite keys का use 1NF और 2NF में किया जाता है।

Advantages Table in Hindi

Advantage Description in Hindi
Unique Identification हर record को uniquely पहचानने में मदद करता है
Data Integrity Duplicate और invalid data को रोकता है
Fast Query Execution Data को तेज़ी से access और retrieve किया जा सकता है
Referential Integrity दो tables के बीच सही relationship बनाए रखता है
Helps in Normalization Keys के बिना database को normalize करना मुमकिन नहीं है

SQL Code Example in Hindi

नीचे एक छोटा सा SQL schema दिया गया है जिसमें Primary Key और Foreign Key दोनों का प्रयोग किया गया है: CREATE TABLE Customers ( Customer_ID INT PRIMARY KEY, Name VARCHAR(100), Email VARCHAR(100) UNIQUE ); CREATE TABLE Orders ( Order_ID INT PRIMARY KEY, Customer_ID INT, Order_Date DATE, FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID) );

Limitations of Keys in ER Model in Hindi

What are the Limitations of Keys in ER Model in Hindi

चलिए एकदम दोस्ताना और समझाने वाले अंदाज़ में बात करते हैं—मान लीजिए आपने एक बढ़िया सा ER Model design किया है जिसमें हर entity के लिए आपने सही key लगा दी है। अब आपको लगता है कि system perfect है, लेकिन ज़िंदगी की तरह हर system की कुछ limitations भी होती हैं, और वही बात यहां Keys पर भी लागू होती है। **Keys** data को uniquely identify करने में तो बहुत मदद करते हैं, लेकिन कई बार इनके अपने कुछ drawbacks या limitations भी सामने आते हैं, जिन्हें समझना बहुत जरूरी है—ताकि हम उन्हें avoid कर सकें या smart तरीके से handle कर सकें।

Main Limitations of Keys in ER Model in Hindi

  • Complexity बढ़ा सकती है: जब किसी table में बहुत सारी candidate keys हों, तो सही key चुनना थोड़ा complex हो जाता है। इससे design complicated हो सकता है और query handling में मुश्किल आ सकती है।
  • Composite Keys Query को मुश्किल बना सकती हैं: Composite keys में एक से ज्यादा attributes होते हैं। जब हम इन keys का use करते हैं, तो SELECT या JOIN queries लंबी और complex बन जाती हैं। इससे performance पर असर पड़ता है।
  • Flexibility कम हो जाती है: एक बार जब हम किसी attribute को Primary Key बना देते हैं, तो future में उस attribute को बदलना risky हो जाता है। क्योंकि उस key पर Foreign Key relationships depend कर रहे होते हैं।
  • Data Migration में Problem: Keys पर बने relationships की वजह से अगर हम एक database से दूसरे database में migration करें, तो Foreign Key constraints migration process को slow या मुश्किल बना सकते हैं।
  • Indexing का Load: Keys पर indexing जरूरी होती है, जिससे बड़ी tables में index का load ज्यादा हो जाता है। इससे performance degrade हो सकता है अगर proper optimization न किया जाए।
  • Redundant Keys से Confusion: कभी-कभी developers एक ही entity के लिए multiple keys define कर देते हैं जो unnecessary complexity create करती है। इससे data modeling में ambiguity आ सकती है।

Limitations Table in Hindi

Limitation Description in Hindi
Complexity Multiple keys होने से ER Model का structure complex हो सकता है
Query Difficulty Composite keys के कारण SQL queries लंबी और hard हो सकती हैं
Low Flexibility Keys को change करना future में मुश्किल हो जाता है
Migration Issues Keys की dependency के कारण database migration कठिन हो सकता है
Performance Issues Indexing के कारण performance पर असर पड़ सकता है

SQL Example Showing Complexity with Composite Keys

नीचे एक छोटा सा उदाहरण है जिसमें Composite Key use की गई है, और ये query को थोड़ा complex बना देता है: CREATE TABLE Student_Course ( Student_ID INT, Course_ID INT, Enrollment_Date DATE, PRIMARY KEY (Student_ID, Course_ID) ); SELECT * FROM Student_Course WHERE Student_ID = 102 AND Course_ID = 501;

FAQs

Key एक ऐसा attribute या attribute का group होता है जो किसी entity set के हर record को uniquely identify करता है। ये database में data consistency और integrity को बनाए रखने के लिए बहुत ज़रूरी होती है।
Keys ER Model में entities को uniquely पहचानने और उनके बीच relationship establish करने में मदद करती हैं। ये redundancy कम करती हैं और data retrieval को तेज़ बनाती हैं।
ER Model में मुख्य रूप से 5 प्रकार की keys होती हैं: Super Key, Candidate Key, Primary Key, Foreign Key और Composite Key। हर एक key का अपना specific role होता है।
Candidate Key हर उस attribute set को कहते हैं जो table में rows को uniquely identify कर सके। इन candidate keys में से एक को चुनकर Primary Key बनाया जाता है। Primary Key हमेशा unique और not null होती है।
Keys के इस्तेमाल से complexity बढ़ सकती है, flexibility कम हो जाती है, composite keys query को कठिन बना देती हैं, और indexing के कारण performance पर असर पड़ सकता है।
सही key चुनने के लिए ऐसे attribute को select करें जो हमेशा unique रहे, null न हो, stable हो (time के साथ बदलता न हो), और जिसका use indexing व relationship creation में आसानी से हो सके।

Please Give Us Feedback