SSC IMD SA 2017 – Question 188

Question:

The use of the ______ clause retains only one copy of duplicate tuples.

______ क्लॉज़ का उपयोग ऐसे समान ट्यूपल्स की केवल एक कॉपी को बरकरार रखता है।

Options:

  • Null
  • Unique
  • Not null
  • Distinct
  • शून्य
  • यूनीक
  • अशक्त नहींं
  • अलग

Correct Answer: d)

Explanation:

Detailed Explanation:

The correct answer is d) DISTINCT (अलग).

In standard SQL, query results generated by a SELECT statement may contain duplicate rows because relational algebra in SQL operates on multisets (bags) rather than pure sets by default:

  • The DISTINCT clause is used in a SELECT statement to filter out duplicate rows from the query output, retaining only one unique copy of each tuple:
SELECT DISTINCT department_name FROM employees;
  • How it works: The database engine sorts the resulting rows or uses a hash table to identify and discard duplicate occurrences of identical tuples.
  • Contrasting other terms:
    • UNIQUE: An integrity constraint enforced on table columns to prevent duplicate entries during data insertion.
    • NULL / NOT NULL: Constraints defining whether a column accepts missing/unassigned values.

विस्तृत व्याख्या:

सही उत्तर d) अलग (DISTINCT) है।

एसक्यूएल (SQL) में SELECT क्वेरी द्वारा प्राप्त परिणामों में डिफ़ॉल्ट रूप से समान (डुप्लिकेट) पंक्तियाँ आ सकती हैं:

  • DISTINCT क्लॉज: इसका उपयोग क्वेरी परिणामों में से डुप्लिकेट ट्यूपल्स (पंक्तियों) को हटाने और प्रत्येक समान ट्यूपल की केवल एक ही कॉपी को प्रदर्शित करने के लिए किया जाता है।
SELECT DISTINCT department_name FROM employees;
  • अन्य विकल्पों से अंतर:
    • UNIQUE: यह टेबल के कॉलम पर लगाया जाने वाला एक कंस्ट्रेंट (बाध्यता) है ताकि प्रविष्टि के समय डुप्लिकेट डेटा न आ सके।
    • DISTINCT: यह एक क्वेरी क्लॉज है जो परिणाम तालिका में से डुप्लिकेट हटाता है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top