2146
GB
How does SQL handle duplicate rows when joining tables with repeated foreign key values?
IN
बार-बार विदेशी कुंजी मानों वाली तालिकाओं में शामिल होने पर SQL डुप्लिकेट पंक्तियों को कैसे संभालता है?
A
Each matching combination of rows produces a row in the result - if table A has 3 rows with dept_id=5 and table B has 2 rows with id=5 the join produces 3 times 2=6 rows for dept_id=5 (multiplicative not additive)
पंक्तियों का प्रत्येक मिलान संयोजन परिणाम में एक पंक्ति उत्पन्न करता है - यदि तालिका A में dept_id=5 के साथ 3 पंक्तियाँ हैं और तालिका B में id=5 के साथ 2 पंक्तियाँ हैं, तो जुड़ने से dept_id=5 के लिए 3 गुना 2=6 पंक्तियाँ उत्पन्न होती हैं (गुणक योगात्मक नहीं)
B
Duplicates are automatically removed
डुप्लिकेट स्वचालित रूप से हटा दिए जाते हैं
C
Duplicates from the same table are removed but not across tables
एक ही तालिका से डुप्लिकेट हटा दिए जाते हैं लेकिन सभी तालिकाओं से नहीं
D
Only the first matching pair is included in the result
परिणाम में केवल पहली मिलान जोड़ी को शामिल किया गया है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
Join cardinality multiplication: for each row in A with join key k, and each row in B with key k, one result row is produced. If A has m rows and B has n rows with key k, the join produces m times n rows for that key value. This is why M:N joins without aggregation produce large result sets.
व्याख्या (हिन्दी)
कार्डिनैलिटी गुणन में शामिल हों: कुंजी k के साथ A में प्रत्येक पंक्ति के लिए, और कुंजी k के साथ B में प्रत्येक पंक्ति के लिए, एक परिणाम पंक्ति उत्पन्न होती है। यदि A में m पंक्तियाँ हैं और B में कुंजी k के साथ n पंक्तियाँ हैं, तो जुड़ाव उस कुंजी मान के लिए m गुना n पंक्तियाँ उत्पन्न करता है। यही कारण है कि M:N एकत्रीकरण के बिना जुड़ने से बड़े परिणाम सेट उत्पन्न होते हैं।