Computer AwarenessHardIBPS SO IT Officer · SBI Clerk Mains
Which statement about DELETE and TRUNCATE in SQL is correct?
- A. TRUNCATE can remove selected rows with WHERE; DELETE always empties the whole table
- B. DELETE removes the table structure as well, while TRUNCATE keeps the structure
- C. DELETE can remove selected rows using WHERE; TRUNCATE empties the table but keeps its structure
- D. Both DELETE and TRUNCATE remove the table's structure along with all its data
Correct answer: C. DELETE can remove selected rows using WHERE; TRUNCATE empties the table but keeps its structure
DELETE is a DML command that may take a WHERE clause; TRUNCATE is a DDL command that removes all rows at once and keeps the table definition. Only DROP removes the structure.
हिंदी में
SQL में DELETE और TRUNCATE के बारे में कौन-सा कथन सही है?
- A. TRUNCATE WHERE से चुनी हुई पंक्तियाँ हटा सकता है; DELETE सदा पूरी तालिका खाली करता है
- B. DELETE तालिका की संरचना भी हटा देता है, जबकि TRUNCATE संरचना रखता है
- C. DELETE WHERE का प्रयोग करके चुनी हुई पंक्तियाँ हटा सकता है; TRUNCATE तालिका खाली करता है पर उसकी संरचना रखता है
- D. DELETE और TRUNCATE दोनों तालिका की संरचना को उसके सारे डेटा के साथ हटा देते हैं
उत्तर: C. DELETE एक DML कमांड है जिसमें WHERE क्लॉज़ हो सकता है; TRUNCATE एक DDL कमांड है जो सभी पंक्तियाँ एक साथ हटाता है और तालिका की परिभाषा रखता है। केवल DROP संरचना हटाता है।
More Computer Awareness questions
- In which order does a database logically process the clauses of a SELECT statement?
- The condition WHERE Salary BETWEEN 20000 AND 30000 selects rows whose salary is:
- A query must list the customers who have no phone number recorded (the Phone column is NULL). Which condition works?
- A City column holds Delhi, Pune, Delhi, NULL, Pune, NULL in six rows. What does SELECT COUNT(DISTINCT City) return?
- A transaction runs: INSERT row 1; SAVEPOINT s1; INSERT row 2; ROLLBACK TO s1; COMMIT. Which of the inserted rows are in the table…
- A transfer debits Account A, but the system crashes before Account B is credited. On restart, the debit is undone, so it is as if the…