DBMS — MCQ Practice

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

📚 130 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
130 questions
76
EN + हिं Medium
GB What is the SQL UPDATE JOIN syntax used for?
IN SQL UPDATE JOIN सिंटैक्स का उपयोग किसके लिए किया जाता है?
A
Performing a JOIN query that includes update logic एक JOIN क्वेरी निष्पादित करना जिसमें अद्यतन तर्क शामिल है
B
Joining two UPDATE statements दो अद्यतन कथनों को जोड़ना
C
Updating foreign key relationships विदेशी कुंजी संबंधों को अद्यतन करना
D
Updating rows in one table based on conditions or values from another table by joining them within the UPDATE statement किसी अन्य तालिका की शर्तों या मानों के आधार पर एक तालिका में पंक्तियों को अद्यतन कथन के भीतर जोड़कर अद्यतन करना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) UPDATE with JOIN: UPDATE orders o JOIN customers c ON o.cust_id=c.id SET o.discount=0.1 WHERE c.tier=gold. Updates order discounts based on customer tier from another table. MySQL syntax differs from standard SQL which uses UPDATE...SET...WHERE col IN (SELECT...) and PostgreSQL uses UPDATE...FROM...WHERE.
व्याख्या (हिन्दी) जॉइन के साथ अपडेट करें: ऑर्डर अपडेट करें ओ ग्राहकों से जुड़ें सी ऑन ओ.कस्ट_आईडी=सी.आईडी सेट ओ.डिस्काउंट=0.1 जहां सी.टीयर=गोल्ड। किसी अन्य तालिका से ग्राहक स्तर के आधार पर ऑर्डर छूट को अद्यतन करता है। MySQL सिंटैक्स मानक SQL से भिन्न है जो UPDATE...SET...WHERE col IN (SELECT...) का उपयोग करता है और PostgreSQL UPDATE...FROM...WHERE का उपयोग करता है।
77
EN + हिं Medium
GB What is INSERT ON CONFLICT DO UPDATE (UPSERT) in PostgreSQL and how does it work?
IN PostgreSQL में INSERT ON CONFLICT DO UPDATE (UPSERT) क्या है और यह कैसे काम करता है?
A
An operation that updates existing rows and inserts new ones in two separate steps एक ऑपरेशन जो मौजूदा पंक्तियों को अद्यतन करता है और दो अलग-अलग चरणों में नई पंक्तियाँ सम्मिलित करता है
B
PostgreSQL syntax for upsert: attempts an INSERT and if a conflict on a specified constraint/column occurs updates the existing row instead of failing - atomic single-statement operation अप्सर्ट के लिए PostgreSQL सिंटैक्स: INSERT का प्रयास करता है और यदि किसी निर्दिष्ट बाधा/कॉलम पर कोई विरोध होता है तो विफल होने के बजाय मौजूदा पंक्ति को अपडेट करता है - परमाणु एकल-कथन ऑपरेशन
C
A PostgreSQL-specific error handling mechanism एक PostgreSQL-विशिष्ट त्रुटि प्रबंधन तंत्र
D
A constraint that prevents conflicting inserts एक बाधा जो परस्पर विरोधी प्रविष्टियों को रोकती है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) INSERT INTO t (id, val) VALUES (1, new) ON CONFLICT (id) DO UPDATE SET val=EXCLUDED.val; - EXCLUDED refers to the row that failed to insert. MySQL equivalent: INSERT...ON DUPLICATE KEY UPDATE. Atomic upsert avoids race conditions of SELECT-then-INSERT-or-UPDATE.
व्याख्या (हिन्दी) टी (आईडी, वैल) मूल्यों में डालें (1, नया) संघर्ष पर (आईडी) सेट अपडेट करें val=EXCLUDED.val; - बहिष्कृत उस पंक्ति को संदर्भित करता है जो सम्मिलित करने में विफल रही। MySQL समतुल्य: डुप्लिकेट कुंजी अद्यतन पर सम्मिलित करें... एटॉमिक अपसर्ट SELECT-then-INSERT-or-UPDATE की दौड़ स्थितियों से बचता है।
78
EN + हिं Easy
GB What does DELETE FROM table1 WHERE id IN (SELECT id FROM table2 WHERE condition) accomplish?
IN DELETE FROMtable1 WHERE id IN (SELECT id FROMtable2 WHEREcondition) क्या पूरा करता है?
A
Creates a backup of deleted rows in table2 तालिका 2 में हटाई गई पंक्तियों का बैकअप बनाता है
B
Deletes rows from table1 whose id values exist in the result set of the subquery from table2 - a correlated delete that removes specific rows based on data in another table तालिका 1 से उन पंक्तियों को हटाता है जिनके आईडी मान तालिका 2 से सबक्वेरी के परिणाम सेट में मौजूद हैं - एक सहसंबद्ध डिलीट जो किसी अन्य तालिका में डेटा के आधार पर विशिष्ट पंक्तियों को हटा देता है
C
Deletes rows from table2 where condition is true तालिका 2 से पंक्तियाँ हटाता है जहाँ शर्त सत्य है
D
Deletes matching rows from both table1 and table2 simultaneously तालिका 1 और तालिका 2 दोनों से मेल खाने वाली पंक्तियों को एक साथ हटा देता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Subquery delete: identifies candidate IDs from table2 using the subquery condition, then deletes those matching rows from table1. Common pattern for cleanup operations. MySQL requires: DELETE t1 FROM t1 JOIN t2 ON ... (cannot use the same table in FROM and subquery in MySQL).
व्याख्या (हिन्दी) सबक्वेरी हटाएं: सबक्वेरी शर्त का उपयोग करके तालिका 2 से उम्मीदवार आईडी की पहचान करता है, फिर तालिका 1 से उन मिलान पंक्तियों को हटा देता है। सफ़ाई कार्यों के लिए सामान्य पैटर्न. MySQL के लिए आवश्यक है: t1 से t1 हटाएं, t2 पर शामिल हों... (FROM में एक ही तालिका और MySQL में सबक्वेरी का उपयोग नहीं किया जा सकता)।
79
EN + हिं Medium
GB What is the SQL RETURNING clause (PostgreSQL SQLite) used for in DML statements?
IN DML स्टेटमेंट में SQL रिटर्निंग क्लॉज (PostgreSQL SQLite) का उपयोग किसके लिए किया जाता है?
A
Returns the values of specified columns from rows that were inserted updated or deleted - useful for retrieving auto-generated values (like IDENTITY/serial IDs) or changed values without a subsequent SELECT उन पंक्तियों से निर्दिष्ट कॉलम के मान लौटाता है जिन्हें अद्यतन या हटा दिया गया था - स्वचालित रूप से जेनरेट किए गए मान (जैसे पहचान/सीरियल आईडी) या बाद के चयन के बिना परिवर्तित मान पुनर्प्राप्त करने के लिए उपयोगी
B
Returning a result set from a stored procedure संग्रहीत प्रक्रिया से परिणाम सेट लौटाना
C
Returning the number of rows affected by the DML डीएमएल से प्रभावित पंक्तियों की संख्या लौटाना
D
Returning error codes from DML operations डीएमएल परिचालन से त्रुटि कोड लौटाना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) RETURNING (PostgreSQL): INSERT INTO t (col) VALUES (v) RETURNING id; - returns the generated ID. UPDATE t SET col=val WHERE id=x RETURNING old_col, new_col; DELETE FROM t WHERE x RETURNING deleted_col; SQL Server uses OUTPUT clause for similar functionality.
व्याख्या (हिन्दी) रिटर्निंग (पोस्टग्रेएसक्यूएल): टी (कॉल) मानों में डालें (v) रिटर्निंग आईडी; - जनरेट की गई आईडी लौटाता है। अद्यतन करें t SET col=val जहां id=x पुराना_col, new_col लौटा रहा है; वहां से हटाएं जहां x लौटाया जा रहा है delete_col; SQL सर्वर समान कार्यक्षमता के लिए OUTPUT क्लॉज का उपयोग करता है।
80
EN + हिं Easy
GB What is the issue with UPDATE employees SET salary = salary * 1.1 WHERE department_id = (SELECT department_id FROM departments WHERE budget > 1000000) if the subquery returns multiple rows?
IN अद्यतन कर्मचारियों के साथ समस्या क्या है सेट वेतन = वेतन * 1.1 जहां विभाग_आईडी = (विभागों से विभाग_आईडी चुनें जहां बजट> 1000000) यदि सबक्वेरी कई पंक्तियाँ लौटाती है?
A
The UPDATE ignores the subquery अद्यतन सबक्वेरी को अनदेखा करता है
B
In most DBMS this fails with subquery returns more than one row error because the = operator expects a single value - should use IN instead of = for multi-row subqueries अधिकांश डीबीएमएस में यह सबक्वेरी के साथ विफल हो जाता है, एक से अधिक पंक्ति त्रुटि देता है क्योंकि = ऑपरेटर एकल मान की अपेक्षा करता है - बहु-पंक्ति सबक्वेरी के लिए = के बजाय IN का उपयोग करना चाहिए
C
The UPDATE applies to only the first returned department अद्यतन केवल पहले लौटे विभाग पर लागू होता है
D
The UPDATE applies to all returned departments अद्यतन सभी लौटाए गए विभागों पर लागू होता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Using = with a subquery that returns multiple rows causes error. Fix: WHERE department_id IN (SELECT department_id FROM departments WHERE budget > 1000000). Or use = ANY() to compare against any value in the result. Always verify whether a subquery can return multiple rows.
व्याख्या (हिन्दी) एकाधिक पंक्तियों को लौटाने वाली सबक्वेरी के साथ = का उपयोग करने से त्रुटि उत्पन्न होती है। ठीक करें: WHERE Department_id IN (विभागों से SELECT Department_ID जहां बजट > 1000000)। या परिणाम में किसी भी मान से तुलना करने के लिए = ANY() का उपयोग करें। हमेशा सत्यापित करें कि क्या कोई सबक्वेरी एकाधिक पंक्तियाँ लौटा सकती है।
81
EN + हिं Easy
GB What is a soft delete pattern and what are its trade-offs?
IN सॉफ्ट डिलीट पैटर्न क्या है और इसके ट्रेड-ऑफ़ क्या हैं?
A
Marking rows as deleted (is_deleted=1 or deleted_at=TIMESTAMP) instead of physically removing them preserving data for audit/recovery at the cost of increased table size and requiring all queries to filter out soft-deleted rows पंक्तियों को भौतिक रूप से हटाने के बजाय उन्हें हटाए गए (is_deleted=1 या delete_at=TIMESTAMP) के रूप में चिह्नित करना, बढ़े हुए तालिका आकार की कीमत पर ऑडिट/पुनर्प्राप्ति के लिए डेटा को संरक्षित करना और सभी क्वेरीज़ को सॉफ्ट-डिलीट की गई पंक्तियों को फ़िल्टर करने की आवश्यकता होती है।
B
Deleting data softly from disk without secure erasure सुरक्षित मिटाए बिना डिस्क से डेटा को धीरे-धीरे हटाना
C
A delete operation that can be undone within a time window एक डिलीट ऑपरेशन जिसे एक समय विंडो के भीतर पूर्ववत किया जा सकता है
D
A delete that only removes indexes but keeps data एक डिलीट जो केवल इंडेक्स को हटाता है लेकिन डेटा रखता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Soft delete: is_deleted TINYINT DEFAULT 0 or deleted_at TIMESTAMP. Pros: audit trail, easy recovery, referential integrity preserved. Cons: table bloat, all queries must add WHERE is_deleted=0 (risk of missing this), unique constraints may conflict with soft-deleted rows, performance degradation over time.
व्याख्या (हिन्दी) Soft delete: is_deleted TINYINT DEFAULT 0 or deleted_at TIMESTAMP. Pros: audit trail, easy recovery, referential integrity preserved. विपक्ष: टेबल ब्लोट, सभी प्रश्नों में WHERE is_deleted=0 जोड़ना होगा (इसके गायब होने का जोखिम), अद्वितीय बाधाएं सॉफ्ट-डिलीट की गई पंक्तियों के साथ संघर्ष कर सकती हैं, समय के साथ प्रदर्शन में गिरावट।
82
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 में काम करता है।
83
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 गुना तेज़ है। लाखों पंक्तियों के लिए लोड डेटा इन्फाइल/कॉपी के साथ इसे और अधिक अनुकूलित किया गया है।
84
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 हेडर से तालिका कॉपी करें।
85
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 पंक्तियाँ प्राप्त करता है)। नई पंक्ति प्रेत है. सीरियलाइज़ेबल आइसोलेशन (रेंज लॉक) या स्नैपशॉट आइसोलेशन (एमवीसीसी) द्वारा रोका गया। पढ़ने के लिए प्रतिबद्ध और दोहराने योग्य पढ़ने के लिए अभी भी प्रेत की अनुमति है।
86
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.
व्याख्या (हिन्दी) व्याख्या: ऑप्टिमाइज़र द्वारा चुनी गई निष्पादन योजना (प्रयुक्त अनुक्रमणिका, जुड़ने के तरीके, अनुमानित पंक्तियाँ/लागत) दिखाता है। व्याख्या विश्लेषण: क्वेरी चलाता है और वास्तविक बनाम अनुमानित पंक्तियाँ, वास्तविक समय, बफर हिट दिखाता है। क्वेरी अनुकूलन के लिए आवश्यक: पूर्ण स्कैन, गलत सूचकांक विकल्प, खराब अनुमान की पहचान करता है।
87
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 इवेंट पर फायर करें। ट्रिगर से पहले: डीएमएल से पहले सक्रिय होता है (मानों को संशोधित कर सकता है, संचालन को रोक सकता है)। ट्रिगर के बाद: डीएमएल के बाद फायर (ऑडिटिंग, कैस्केड के लिए)। ट्रिगर के बजाय: डीएमएल ऑपरेशन को प्रतिस्थापित करता है (अद्यतन योग्य दृश्य तर्क के लिए उपयोग किया जाता है)। पुराने और नए पंक्ति मानों तक पहुंच सकते हैं।
88
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 क्वेरी)। आलसी लोडिंग वाले ओआरएम में आम।
89
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-विशिष्ट व्यवहार पर निर्भर करता है।
90
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), यदि संस्करण बदल गया है तो पुनः प्रयास करें। दुर्लभ विवादों वाले कम-विवाद वाले डेटा के लिए अच्छा है।
76–90 of 130