DBMS — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 2982 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
2982 questions
1561
EN + हिं Easy
GB What does UPDATE...SET col = DEFAULT accomplish in SQL?
IN SQL में UPDATE...SET col = DEFAULT क्या पूरा करता है?
A
Sets the column value to its defined DEFAULT value (as specified in the column definition) resetting it to the default without needing to know the actual default value कॉलम मान को उसके परिभाषित डिफ़ॉल्ट मान पर सेट करता है (जैसा कि कॉलम परिभाषा में निर्दिष्ट है) वास्तविक डिफ़ॉल्ट मान को जानने की आवश्यकता के बिना इसे डिफ़ॉल्ट पर रीसेट करता है
B
Is invalid SQL syntax अमान्य SQL सिंटैक्स है
C
Sets the column to NULL कॉलम को NULL पर सेट करता है
D
Sets the column to 0 कॉलम को 0 पर सेट करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) SET col = DEFAULT: resets a column to its defined default value, even if you do not know the exact default in your query. Useful for: resetting configuration values, resetting status fields, bulk-resetting optional fields. Works in PostgreSQL, MySQL, and standard SQL.
व्याख्या (हिन्दी) SET col = DEFAULT: किसी कॉलम को उसके परिभाषित डिफ़ॉल्ट मान पर रीसेट करता है, भले ही आप अपनी क्वेरी में सटीक डिफ़ॉल्ट नहीं जानते हों। इनके लिए उपयोगी: कॉन्फ़िगरेशन मान रीसेट करना, स्थिति फ़ील्ड रीसेट करना, वैकल्पिक फ़ील्ड को बल्क-रीसेट करना। PostgreSQL, MySQL और मानक SQL में काम करता है।
1562
EN + हिं Medium
GB What is the multi-row INSERT optimization and why is it significantly faster than multiple single-row INSERTs?
IN बहु-पंक्ति INSERT अनुकूलन क्या है और यह एकाधिक एकल-पंक्ति INSERT की तुलना में काफी तेज़ क्यों है?
A
Multi-row INSERT sends one network round-trip parses one SQL statement and applies one transaction commit for all rows vs. N round-trips/parses/commits for N single-row inserts - orders of magnitude faster for bulk loads बहु-पंक्ति INSERT एक नेटवर्क राउंड-ट्रिप पार्स एक SQL स्टेटमेंट भेजता है और सभी पंक्तियों के लिए एक लेनदेन कमिट लागू करता है बनाम एन सिंगल-पंक्ति इंसर्ट के लिए एन राउंड-ट्रिप/पार्स/कमिट - बल्क लोड के लिए तेजी से परिमाण के आदेश
B
It is not faster; single-row inserts are more optimized यह तेज़ नहीं है; single-row inserts are more optimized
C
It uses different storage algorithms यह विभिन्न स्टोरेज एल्गोरिदम का उपयोग करता है
D
It bypasses transaction logging entirely यह लेनदेन लॉगिंग को पूरी तरह से बायपास कर देता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Multi-row INSERT benefits: single network round-trip (huge for remote connections), single statement parse/plan, single transaction overhead. For 10,000 rows: 1 multi-row INSERT is typically 10-100x faster than 10,000 individual INSERTs. Further optimized with LOAD DATA INFILE/COPY for millions of rows.
व्याख्या (हिन्दी) बहु-पंक्ति INSERT लाभ: एकल नेटवर्क राउंड-ट्रिप (दूरस्थ कनेक्शन के लिए विशाल), एकल कथन पार्स/योजना, एकल लेनदेन ओवरहेड। 10,000 पंक्तियों के लिए: 1 बहु-पंक्ति INSERT आमतौर पर 10,000 व्यक्तिगत INSERT से 10-100 गुना तेज़ है। लाखों पंक्तियों के लिए लोड डेटा इन्फाइल/कॉपी के साथ इसे और अधिक अनुकूलित किया गया है।
1563
EN + हिं Easy
GB What is LOAD DATA INFILE (MySQL) or COPY (PostgreSQL) and when is it used?
IN लोड डेटा इन्फाइल (MySQL) या COPY (PostgreSQL) क्या है और इसका उपयोग कब किया जाता है?
A
Loading data from the internet into MySQL इंटरनेट से MySQL में डेटा लोड करना
B
Loading stored procedure definitions from files फ़ाइलों से संग्रहीत प्रक्रिया परिभाषाएँ लोड हो रही हैं
C
A high-performance bulk data loading operation that reads data directly from a file (CSV TSV etc.) into a table bypassing many SQL processing overheads - typically 10-100x faster than INSERT statements for large datasets एक उच्च-प्रदर्शन बल्क डेटा लोडिंग ऑपरेशन जो कई SQL प्रोसेसिंग ओवरहेड्स को दरकिनार करते हुए एक फ़ाइल (सीएसवी टीएसवी आदि) से सीधे डेटा को एक तालिका में पढ़ता है - आमतौर पर बड़े डेटासेट के लिए INSERT स्टेटमेंट की तुलना में 10-100x तेज
D
Loading backup files into the database डेटाबेस में बैकअप फ़ाइलें लोड हो रही हैं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) LOAD DATA INFILE file INTO TABLE t FIELDS TERMINATED BY , LINES TERMINATED BY newline: reads CSV/TSV files, can skip headers, transform data. Much faster than INSERT because: bypasses SQL parsing, uses optimized bulk file I/O, can defer index updates. PostgreSQL: COPY table FROM /path/to/file CSV HEADER.
व्याख्या (हिन्दी) डेटा इनफ़ाइल फ़ाइल को टेबल टी फ़ील्ड में लोड करें, नई लाइन द्वारा समाप्त की गई लाइनें: सीएसवी/टीएसवी फाइलें पढ़ता है, हेडर छोड़ सकता है, डेटा बदल सकता है। INSERT की तुलना में बहुत तेज़ क्योंकि: SQL पार्सिंग को बायपास करता है, अनुकूलित बल्क फ़ाइल I/O का उपयोग करता है, इंडेक्स अपडेट को स्थगित कर सकता है। PostgreSQL: /path/to/file CSV हेडर से तालिका कॉपी करें।
1564
EN + हिं Hard
GB What is a phantom read in the context of DML and transaction isolation?
IN डीएमएल और लेनदेन अलगाव के संदर्भ में पढ़ा जाने वाला फैंटम क्या है?
A
A read that returns different column values for the same row एक रीड जो एक ही पंक्ति के लिए अलग-अलग कॉलम मान लौटाता है
B
A read that returns no results when data exists एक रीड जो डेटा मौजूद होने पर कोई परिणाम नहीं देता है
C
A read on a table that has been dropped एक मेज़ पर पढ़ा हुआ पाठ जो गिरा दिया गया है
D
A phenomenon where a transaction re-executes a query and finds new rows that were inserted by another committed transaction since the first read - occurs at READ COMMITTED isolation level prevented by SERIALIZABLE एक घटना जहां एक लेन-देन एक क्वेरी को फिर से निष्पादित करता है और नई पंक्तियां पाता है जो पहले पढ़ने के बाद से किसी अन्य प्रतिबद्ध लेनदेन द्वारा डाली गई थीं - रीड कमिटेड अलगाव स्तर पर होती है जिसे SERIALIZABLE द्वारा रोका जाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Phantom read: T1 runs SELECT WHERE age>30 (gets 5 rows). T2 inserts a new row with age=35 and commits. T1 re-runs same SELECT (gets 6 rows). The new row is the phantom. Prevented by SERIALIZABLE isolation (range locks) or SNAPSHOT isolation (MVCC). READ COMMITTED and REPEATABLE READ still allow phantoms.
व्याख्या (हिन्दी) फैंटम ने पढ़ा: T1 SELECT WHERE चलाता है जहाँ उम्र>30 (5 पंक्तियाँ मिलती हैं)। T2 आयु=35 के साथ एक नई पंक्ति सम्मिलित करता है और प्रतिबद्ध होता है। T1 उसी SELECT को पुनः चलाता है (6 पंक्तियाँ प्राप्त करता है)। नई पंक्ति प्रेत है. सीरियलाइज़ेबल आइसोलेशन (रेंज लॉक) या स्नैपशॉट आइसोलेशन (एमवीसीसी) द्वारा रोका गया। पढ़ने के लिए प्रतिबद्ध और दोहराने योग्य पढ़ने के लिए अभी भी प्रेत की अनुमति है।
1565
EN + हिं Hard
GB What is the SQL EXPLAIN / EXPLAIN ANALYZE statement used for in query optimization?
IN क्वेरी ऑप्टिमाइज़ेशन में SQL EXPLAIN / EXPLAIN ANALYZE स्टेटमेंट का उपयोग किस लिए किया जाता है?
A
To explain the SQL syntax to beginners शुरुआती लोगों को SQL सिंटैक्स समझाने के लिए
B
EXPLAIN shows the query execution plan (without executing); EXPLAIN ANALYZE actually executes the query and shows the plan with real timing/row counts - used to diagnose slow queries check index usage identify full table scans EXPLAIN shows the query execution plan (without executing); व्याख्या विश्लेषण वास्तव में क्वेरी निष्पादित करता है और वास्तविक समय/पंक्ति गणना के साथ योजना दिखाता है - धीमी क्वेरी का निदान करने के लिए उपयोग किया जाता है, इंडेक्स उपयोग की जांच करें, पूर्ण तालिका स्कैन की पहचान करें
C
To explain the table structure तालिका संरचना को समझाने के लिए
D
To show query syntax errors क्वेरी सिंटैक्स त्रुटियाँ दिखाने के लिए
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) EXPLAIN: shows the optimizer chosen execution plan (indexes used, join methods, estimated rows/cost). EXPLAIN ANALYZE: runs the query and shows actual vs. estimated rows, actual timing, buffer hits. Essential for query optimization: identifies full scans, wrong index choices, bad estimates.
व्याख्या (हिन्दी) व्याख्या: ऑप्टिमाइज़र द्वारा चुनी गई निष्पादन योजना (प्रयुक्त अनुक्रमणिका, जुड़ने के तरीके, अनुमानित पंक्तियाँ/लागत) दिखाता है। व्याख्या विश्लेषण: क्वेरी चलाता है और वास्तविक बनाम अनुमानित पंक्तियाँ, वास्तविक समय, बफर हिट दिखाता है। क्वेरी अनुकूलन के लिए आवश्यक: पूर्ण स्कैन, गलत सूचकांक विकल्प, खराब अनुमान की पहचान करता है।
1566
EN + हिं Easy
GB What is a DML trigger and what events can fire it?
IN डीएमएल ट्रिगर क्या है और कौन सी घटनाएं इसे सक्रिय कर सकती हैं?
A
A special type of stored procedure executed manually एक विशेष प्रकार की संग्रहीत प्रक्रिया जिसे मैन्युअल रूप से निष्पादित किया जाता है
B
A stored procedure automatically executed by the DBMS in response to specific DML events (INSERT, UPDATE, DELETE) on a table either BEFORE or AFTER the event or INSTEAD OF for views विशिष्ट डीएमएल घटनाओं (INSERT, UPDATE, DELETE) के जवाब में DBMS द्वारा घटना से पहले या बाद में या दृश्यों के बजाय एक टेबल पर स्वचालित रूप से निष्पादित एक संग्रहीत प्रक्रिया
C
A scheduled automatic data modification एक अनुसूचित स्वचालित डेटा संशोधन
D
A constraint that fires when DML fails एक बाधा जो डीएमएल के विफल होने पर सक्रिय हो जाती है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) DML triggers: fire on INSERT, UPDATE, DELETE events. BEFORE trigger: fires before the DML (can modify values, prevent operation). AFTER trigger: fires after DML (for auditing, cascades). INSTEAD OF trigger: replaces the DML operation (used for updatable view logic). Can access OLD and NEW row values.
व्याख्या (हिन्दी) डीएमएल ट्रिगर्स: INSERT, UPDATE, DELETE इवेंट पर फायर करें। ट्रिगर से पहले: डीएमएल से पहले सक्रिय होता है (मानों को संशोधित कर सकता है, संचालन को रोक सकता है)। ट्रिगर के बाद: डीएमएल के बाद फायर (ऑडिटिंग, कैस्केड के लिए)। ट्रिगर के बजाय: डीएमएल ऑपरेशन को प्रतिस्थापित करता है (अद्यतन योग्य दृश्य तर्क के लिए उपयोग किया जाता है)। पुराने और नए पंक्ति मानों तक पहुंच सकते हैं।
1567
EN + हिं Easy
GB What is the N+1 query problem in the context of DML/SELECT operations?
IN DML/SELECT संचालन के संदर्भ में N+1 क्वेरी समस्या क्या है?
A
A problem with UPDATE queries affecting N+1 rows N+1 पंक्तियों को प्रभावित करने वाली अद्यतन क्वेरीज़ में एक समस्या
B
Executing 1 query to fetch N parent records then N additional queries to fetch related child records for each parent (N+1 total queries) instead of using a single JOIN - causes severe performance problems as N grows एन पैरेंट रिकॉर्ड लाने के लिए 1 क्वेरी निष्पादित करना, फिर एकल जॉइन का उपयोग करने के बजाय प्रत्येक पैरेंट (एन+1 कुल क्वेरी) के लिए संबंधित चाइल्ड रिकॉर्ड लाने के लिए एन अतिरिक्त क्वेरी निष्पादित करना - जैसे-जैसे एन बढ़ता है, गंभीर प्रदर्शन समस्याएं पैदा होती हैं
C
Inserting N+1 rows per transaction प्रति लेनदेन N+1 पंक्तियाँ सम्मिलित करना
D
Performing N+1 identical queries N+1 समान क्वेरी निष्पादित करना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) N+1 problem: SELECT * FROM orders (1 query, gets 100 orders). Then for each order: SELECT * FROM items WHERE order_id=? (100 queries) = 101 total queries. Solution: JOIN in single query: SELECT o.*, i.* FROM orders o JOIN items i ON o.id=i.order_id (1 query). Common in ORMs with lazy loading.
व्याख्या (हिन्दी) एन+1 समस्या: ऑर्डर से चुनें * (1 क्वेरी, 100 ऑर्डर मिलते हैं)। फिर प्रत्येक ऑर्डर के लिए: आइटम से चुनें जहां order_id=? (100 प्रश्न) = 101 कुल प्रश्न। समाधान: एकल क्वेरी में शामिल हों: ऑर्डर से o.*, i.* चुनें o आइटम्स में शामिल हों i ON o.id=i.order_id (1 क्वेरी)। आलसी लोडिंग वाले ओआरएम में आम।
1568
EN + हिं Easy
GB What is the effect of executing an UPDATE on a row where the SET clause does not change any values?
IN उस पंक्ति पर अद्यतन निष्पादित करने का क्या प्रभाव पड़ता है जहां SET क्लॉज कोई मान नहीं बदलता है?
A
The UPDATE fails अद्यतन विफल रहता है
B
An error is raised एक त्रुटि सामने आई है
C
The row is deleted and re-inserted पंक्ति हटा दी गई है और पुनः सम्मिलित कर दी गई है
D
The DBMS may either skip the update entirely (optimized) or perform a no-op update; triggers still fire in most DBMS; the behavior depends on the DBMS implementation but no data change occurs DBMS या तो अपडेट को पूरी तरह से छोड़ सकता है (अनुकूलित) या नो-ऑप अपडेट कर सकता है; अधिकांश DBMS में ट्रिगर अभी भी सक्रिय हैं; व्यवहार DBMS कार्यान्वयन पर निर्भर करता है लेकिन कोई डेटा परिवर्तन नहीं होता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) UPDATE with unchanged values: logically a no-op. DBMS may detect no change and skip the write (optimization). However, BEFORE UPDATE triggers still fire in most DBMS. ON UPDATE CURRENT_TIMESTAMP may still update timestamp even with no data change. Depends on DBMS-specific behavior.
व्याख्या (हिन्दी) अपरिवर्तित मूल्यों के साथ अद्यतन करें: तार्किक रूप से कोई विकल्प नहीं। DBMS कोई परिवर्तन नहीं देख सकता है और लिखना (अनुकूलन) छोड़ सकता है। हालाँकि, अधिकांश DBMS में BORE UPDATE ट्रिगर्स अभी भी सक्रिय हैं। अद्यतन करने पर CURRENT_TIMESTAMP बिना किसी डेटा परिवर्तन के भी टाइमस्टैम्प को अपडेट कर सकता है। DBMS-विशिष्ट व्यवहार पर निर्भर करता है।
1569
EN + हिं Easy
GB What is optimistic locking vs pessimistic locking in the context of concurrent DML operations?
IN समवर्ती डीएमएल संचालन के संदर्भ में आशावादी लॉकिंग बनाम निराशावादी लॉकिंग क्या है?
A
They produce identical results वे समान परिणाम देते हैं
B
Pessimistic: locks data when reading to prevent concurrent modifications (SELECT FOR UPDATE); Optimistic: no locks checks at update time if data changed since read (using version column or timestamp) fails with retry if another update occurred Pessimistic: locks data when reading to prevent concurrent modifications (SELECT FOR UPDATE); आशावादी: यदि पढ़ने के बाद से डेटा बदल गया है (संस्करण कॉलम या टाइमस्टैम्प का उपयोग करके) अपडेट समय पर कोई लॉक चेक नहीं होता है, तो कोई अन्य अपडेट होने पर पुनः प्रयास करने में विफल रहता है
C
Optimistic locking uses database locks; pessimistic uses application locks आशावादी लॉकिंग डेटाबेस लॉक का उपयोग करती है; निराशावादी एप्लिकेशन लॉक का उपयोग करता है
D
Optimistic uses more locks; pessimistic uses fewer Optimistic uses more locks; निराशावादी कम उपयोग करते हैं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Pessimistic: lock on read (SELECT...FOR UPDATE), prevents other modifications until transaction completes. Good for high-contention data. Optimistic: no read lock, check version on UPDATE (WHERE id=x AND version=v), retry if version changed. Good for low-contention data with rare conflicts.
व्याख्या (हिन्दी) निराशावादी: पढ़ने पर लॉक (चयन करें...अद्यतन के लिए), लेन-देन पूरा होने तक अन्य संशोधनों को रोकता है। उच्च-विवाद वाले डेटा के लिए अच्छा है। आशावादी: कोई रीड लॉक नहीं, अद्यतन पर संस्करण की जाँच करें (जहां आईडी = x और संस्करण = v), यदि संस्करण बदल गया है तो पुनः प्रयास करें। दुर्लभ विवादों वाले कम-विवाद वाले डेटा के लिए अच्छा है।
1570
EN + हिं Medium
GB In DML what is LIMIT with UPDATE/DELETE and why is it useful?
IN डीएमएल में अपडेट/डिलीट के साथ LIMIT क्या है और यह उपयोगी क्यों है?
A
LIMIT changes the locking behavior of UPDATE/DELETE LIMIT UPDATE/DELETE के लॉकिंग व्यवहार को बदल देता है
B
LIMIT is only for SELECT statements in all DBMS LIMIT सभी DBMS में केवल SELECT स्टेटमेंट के लिए है
C
A syntax error - LIMIT cannot be used with UPDATE/DELETE एक सिंटैक्स त्रुटि - LIMIT का उपयोग UPDATE/DELETE के साथ नहीं किया जा सकता
D
MySQL supports DELETE FROM t WHERE condition ORDER BY col LIMIT n to safely delete/update a bounded number of rows - prevents accidentally deleting millions of rows and allows safe batch operations MySQL पंक्तियों की सीमित संख्या को सुरक्षित रूप से हटाने/अद्यतन करने के लिए col LIMIT n द्वारा DELETE FROM t WHERE स्थिति का समर्थन करता है - गलती से लाखों पंक्तियों को हटाने से रोकता है और सुरक्षित बैच संचालन की अनुमति देता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) MySQL: DELETE FROM log WHERE created_at < 2020-01-01 ORDER BY id LIMIT 1000; Useful for: safe batch deletes (prevents huge single transactions), purging old data in chunks to avoid replication lag, throttling bulk operations to reduce lock contention.
व्याख्या (हिन्दी) MySQL: लॉग से हटाएं जहां बनाया_at <2020-01-01 आईडी सीमा 1000 द्वारा ऑर्डर करें; इसके लिए उपयोगी: सुरक्षित बैच हटाता है (बड़े एकल लेनदेन को रोकता है), प्रतिकृति अंतराल से बचने के लिए पुराने डेटा को टुकड़ों में शुद्ध करता है, लॉक विवाद को कम करने के लिए बल्क ऑपरेशंस को थ्रॉटल करता है।
1571
EN + हिं Easy
GB What is the SQL WITH CHECK OPTION clause when creating an updatable view?
IN अद्यतन करने योग्य दृश्य बनाते समय SQL with CHECK OPTION क्लॉज क्या है?
A
It checks the syntax of the view definition यह दृश्य परिभाषा के सिंटैक्स की जाँच करता है
B
It restricts who can modify rows through the view यह प्रतिबंधित करता है कि कौन दृश्य के माध्यम से पंक्तियों को संशोधित कर सकता है
C
It ensures that INSERT and UPDATE operations through the view only accept rows that satisfy the view WHERE clause - preventing modifications that would make the row invisible through the view यह सुनिश्चित करता है कि दृश्य के माध्यम से INSERT और UPDATE संचालन केवल उन पंक्तियों को स्वीकार करते हैं जो दृश्य को संतुष्ट करते हैं WHERE क्लॉज - उन संशोधनों को रोकते हैं जो पंक्ति को दृश्य के माध्यम से अदृश्य बना देंगे
D
It checks that the view returns the correct number of rows यह जाँचता है कि दृश्य पंक्तियों की सही संख्या लौटाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) WITH CHECK OPTION: CREATE VIEW active_emp AS SELECT * FROM emp WHERE status=active WITH CHECK OPTION. Any INSERT/UPDATE through this view that would create/modify a row with status not equal to active is rejected. Without it, you could insert inactive status rows that disappear from the view.
व्याख्या (हिन्दी) चेक विकल्प के साथ: व्यू एक्टिव_एम्प को चयन के रूप में बनाएं * एम्प से जहां स्टेटस=चेक विकल्प के साथ सक्रिय है। इस दृश्य के माध्यम से कोई भी INSERT/UPDATE जो सक्रिय के बराबर नहीं स्थिति वाली एक पंक्ति बनाएगा/संशोधित करेगा, अस्वीकार कर दिया गया है। इसके बिना, आप निष्क्रिय स्थिति पंक्तियाँ सम्मिलित कर सकते हैं जो दृश्य से गायब हो जाती हैं।
1572
EN + हिं Easy
GB What is the performance implication of an UPDATE on an indexed column?
IN अनुक्रमित कॉलम पर अद्यतन का प्रदर्शन निहितार्थ क्या है?
A
Indexes always make UPDATEs faster इंडेक्स हमेशा अपडेट को तेज़ बनाते हैं
B
Indexes have no effect on UPDATE performance अद्यतन प्रदर्शन पर अनुक्रमणिका का कोई प्रभाव नहीं पड़ता है
C
Updating an indexed column requires updating both the table row AND all indexes on that column making writes more expensive (each index requires a delete+insert in the B-tree structure) - the more indexes the slower the UPDATE किसी अनुक्रमित कॉलम को अपडेट करने के लिए तालिका पंक्ति और उस कॉलम के सभी इंडेक्स दोनों को अपडेट करने की आवश्यकता होती है, जिससे लिखना अधिक महंगा हो जाता है (प्रत्येक इंडेक्स को बी-ट्री संरचना में डिलीट + इंसर्ट की आवश्यकता होती है) - जितने अधिक इंडेक्स होंगे, अपडेट उतना ही धीमा होगा
D
Only primary key indexes affect UPDATE performance केवल प्राथमिक कुंजी सूचकांक ही अद्यतन प्रदर्शन को प्रभावित करते हैं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) UPDATE on indexed column overhead: (1) Find and update the row in the heap/clustered index. (2) For EACH non-clustered index containing that column: remove old entry from B-tree, insert new entry at new position. With 5 indexes on updated column, one UPDATE performs 6+ I/O operations minimum.
व्याख्या (हिन्दी) अनुक्रमित कॉलम ओवरहेड पर अद्यतन करें: (1) ढेर/संकुल सूचकांक में पंक्ति ढूंढें और अद्यतन करें। (2) उस कॉलम वाले प्रत्येक गैर-संकुल सूचकांक के लिए: बी-ट्री से पुरानी प्रविष्टि हटाएं, नई स्थिति में नई प्रविष्टि डालें। अपडेट किए गए कॉलम पर 5 इंडेक्स के साथ, एक अपडेट न्यूनतम 6+ I/O ऑपरेशन करता है।
1573
EN + हिं Easy
GB What is a bulk update pattern and how can it be implemented efficiently?
IN बल्क अपडेट पैटर्न क्या है और इसे कुशलतापूर्वक कैसे लागू किया जा सकता है?
A
A batch of UPDATE statements executed in parallel अद्यतन कथनों का एक बैच समानांतर में निष्पादित किया गया
B
Updating rows across multiple tables in one statement एक कथन में एकाधिक तालिकाओं में पंक्तियाँ अद्यतन करना
C
Updating all rows in a table at once किसी तालिका की सभी पंक्तियों को एक साथ अद्यतन करना
D
Updating many rows efficiently by using a single UPDATE with a JOIN or CASE expression to set different values per row based on a mapping table rather than executing N individual UPDATE statements एन व्यक्तिगत अपडेट स्टेटमेंट निष्पादित करने के बजाय मैपिंग तालिका के आधार पर प्रति पंक्ति अलग-अलग मान सेट करने के लिए जॉइन या केस अभिव्यक्ति के साथ एक अद्यतन का उपयोग करके कई पंक्तियों को कुशलतापूर्वक अपडेट करना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Efficient bulk update: instead of 10,000 individual UPDATEs: (1) Load mapping into temp table: (id, new_value). (2) Single UPDATE: UPDATE t JOIN temp ON t.id=temp.id SET t.col=temp.new_value. Or use CASE: UPDATE t SET col = CASE id WHEN 1 THEN val1 WHEN 2 THEN val2 END WHERE id IN (1,2).
व्याख्या (हिन्दी) कुशल थोक अद्यतन: 10,000 व्यक्तिगत अद्यतनों के बजाय: (1) अस्थायी तालिका में मैपिंग लोड करें: (आईडी, नया_मूल्य)। (2) एकल अद्यतन: t.id=temp.id SET t.col=temp.new_value पर अस्थायी रूप से जुड़ने के लिए अद्यतन करें। या केस का उपयोग करें: अद्यतन टी सेट कॉल = केस आईडी जब 1 तब वैल1 जब 2 तब वैल2 समाप्त होता है जहां आईडी (1,2) होती है।
1574
EN + हिं Medium
GB What is the SQL OUTPUT clause in SQL Server (or RETURNING in PostgreSQL) and how does it enable auditing patterns?
IN SQL सर्वर में SQL आउटपुट क्लॉज (या PostgreSQL में रिटर्निंग) क्या है और यह ऑडिटिंग पैटर्न को कैसे सक्षम करता है?
A
It outputs query results to a file यह क्वेरी परिणामों को एक फ़ाइल में आउटपुट करता है
B
It writes modified data to a log file यह संशोधित डेटा को लॉग फ़ाइल में लिखता है
C
It outputs execution plan information यह निष्पादन योजना की जानकारी आउटपुट करता है
D
It returns the values of modified rows from INSERT/UPDATE/DELETE operations enabling patterns like: capturing deleted row data into an audit table in a single statement or retrieving auto-generated IDs after INSERT without a separate SELECT यह INSERT/UPDATE/DELETE ऑपरेशंस से संशोधित पंक्तियों के मान लौटाता है, जिससे पैटर्न सक्षम होते हैं: हटाए गए पंक्ति डेटा को एक ही स्टेटमेंट में ऑडिट टेबल में कैप्चर करना या अलग सेलेक्ट के बिना INSERT के बाद ऑटो-जेनरेट की गई आईडी को पुनः प्राप्त करना।
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) SQL Server: DELETE FROM t OUTPUT DELETED.* INTO audit_table WHERE condition - atomically moves deleted rows to audit table in one statement. INSERT INTO t OUTPUT INSERTED.id, INSERTED.created_at VALUES (...) - returns generated values. Prevents race conditions of separate SELECT after DML.
व्याख्या (हिन्दी) एसक्यूएल सर्वर: डिलीट फ्रॉम टी आउटपुट डिलीटेड। * ऑडिट_टेबल में जहां स्थिति - हटाए गए पंक्तियों को एक स्टेटमेंट में ऑडिट टेबल पर ले जाता है। आउटपुट में सम्मिलित करें INSERTED.id, INSERTED.created_at मान (...) - उत्पन्न मान लौटाता है। डीएमएल के बाद अलग चयन की दौड़ की स्थिति को रोकता है।
1575
EN + हिं Easy
GB What is the MERGE statement and when should it be preferred over separate INSERT/UPDATE/DELETE?
IN मर्ज स्टेटमेंट क्या है और इसे अलग-अलग INSERT/UPDATE/DELETE की तुलना में कब प्राथमिकता दी जानी चाहिए?
A
MERGE performs INSERT UPDATE or DELETE in a single atomic statement based on whether rows match between source and target - preferred when you need to synchronize two tables and want to avoid race conditions of separate read-then-write operations स्रोत और लक्ष्य के बीच पंक्तियाँ मेल खाती हैं या नहीं, इसके आधार पर MERGE एकल परमाणु कथन में INSERT UPDATE या DELETE निष्पादित करता है - पसंदीदा तब जब आपको दो तालिकाओं को सिंक्रनाइज़ करने की आवश्यकता होती है और अलग-अलग पढ़ने-फिर-लिखने के संचालन की दौड़ स्थितियों से बचना चाहते हैं
B
MERGE always outperforms separate DML statements MERGE हमेशा अलग-अलग DML स्टेटमेंट से बेहतर प्रदर्शन करता है
C
MERGE is identical to INSERT ON DUPLICATE KEY UPDATE मर्ज डुप्लिकेट कुंजी अद्यतन पर सम्मिलित करें के समान है
D
MERGE is only for bulk operations over 1000 rows MERGE केवल 1000 पंक्तियों से अधिक के थोक संचालन के लिए है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) MERGE (UPSERT): single atomic statement avoids race conditions (read to check existence, then write). Preferred for: ETL synchronization (sync staging to production), slowly-changing dimensions, inventory updates. Avoids: TOC/TOU (time-of-check/time-of-use) race condition in SELECT then INSERT/UPDATE pattern.
व्याख्या (हिन्दी) मर्ज (अपसर्ट): एकल परमाणु कथन नस्ल की स्थिति से बचाता है (अस्तित्व की जांच करने के लिए पढ़ें, फिर लिखें)। इसके लिए पसंदीदा: ईटीएल सिंक्रनाइज़ेशन (उत्पादन के लिए सिंक स्टेजिंग), धीरे-धीरे बदलते आयाम, इन्वेंट्री अपडेट। टालें: टीओसी/टीओयू (चेक-ऑफ-चेक/टाइम-ऑफ-यूज) दौड़ की स्थिति पहले सेलेक्ट करें फिर इन्सर्ट/अपडेट पैटर्न में।
1561–1575 of 2982