Relation, Tuple, Attribute, Domain, Degree और Cardinality
औपचारिक शब्द
किताबें relational databases को relation, tuple, attribute, domain, degree और cardinality जैसे औपचारिक शब्दों से वर्णित करती हैं। ये जटिल लगते हैं, पर हर एक बस table के परिचित हिस्से का नाम है। इन्हें सीखना आपको DBMS theory और exam सवाल आसानी से पढ़ने में मदद करता है।
Relation
Relation बस एक table है — rows और columns का set। यह शब्द relational model के गणितीय आधार से आता है। जब भी आप "relation" पढ़ें, एक table की कल्पना कीजिए।
| roll | name | marks |
|---|---|---|
| 1 | Aman | 88 |
| 2 | Diya | 92 |
यह पूरी table एक relation है, (मान लीजिए) Students कहलाती।
Tuple और attribute
- Tuple — एक row (record)। ऊपर की table में,
(1, Aman, 88)एक tuple है। - Attribute — एक column (field)।
roll,nameऔरmarksattributes हैं।
तो relation tuples (rows) से बनी है, और हर tuple के हर attribute (column) की एक value है।
Domain
Domain किसी attribute के लिए allowed values का set है। जैसे:
marksका domain: 0 से 100 तक integers।nameका domain: अक्षरों की strings।genderका domain: {Male, Female, Other}।
किसी attribute में कोई भी value उसके domain से आनी चाहिए, जो data मान्य रखता है।
Degree और cardinality
- Degree — attributes (columns) की संख्या। Students relation का degree 3 है।
- Cardinality — tuples (rows) की संख्या। 2 students के साथ, cardinality 2 है।
याद रखने का आसान तरीका: degree columns गिनता है, cardinality rows गिनती है।
संबंधित key शब्द
- Relation schema — संरचना:
Students(roll, name, marks)। - Relation instance — किसी पल की असली rows।
- Primary key — वो attribute जो हर tuple को विशिष्ट पहचानता है।
ये औपचारिक शब्दों को उस schema-और-instance विचार से जोड़ते हैं जो आप पहले से जानते हैं।
आम गलतियाँ
- यह सोचना "relation" मतलब relationship। Relation एक table है, tables के बीच link नहीं।
- Degree और cardinality बदलना। Degree = columns; cardinality = rows।
- Domain को data type से मिलाना। Domain allowed value set है; data type व्यापक है।
- Tuple और attribute मिलाना। Tuple एक row है; attribute एक column।
सारांश
- Relation = table; tuple = row; attribute = column।
- Domain = किसी attribute के लिए allowed values।
- Degree = columns की संख्या; cardinality = rows की संख्या।
- Relation schema संरचना है; instance मौजूदा data।
- ये औपचारिक शब्द बस परिचित table हिस्सों को फिर से नाम देते हैं।
आगे, model दोहराइए relational database में, या संरचना बनाम data विचार schema vs instance में।
