Question
Which SQL command is used to remove only specific rows
from a table while preserving the structure and other rows?Solution
The DELETE command in SQL is used to remove specific rows from a table based on a WHERE clause condition. Unlike DROP or TRUNCATE, which impact the entire table, DELETE operates on a more granular level, enabling selective removal of data while preserving the table structure and any other rows. For example: DELETE FROM employees WHERE department = 'Sales'; This query removes only the rows from the employees table where the department is 'Sales', leaving all other rows intact. Additionally, the DELETE command logs each deleted row, making it possible to rollback transactions if the database supports it (e.g., in databases using transaction control). This makes DELETE particularly useful for scenarios where precision and rollback capabilities are required. Explanation of Incorrect Options: A) DROP : The DROP command is used to completely remove a table or database, including its structure. It is not selective and deletes the entire object. B) TRUNCATE : While TRUNCATE removes all rows from a table, it does not allow selective deletion. Furthermore, TRUNCATE is faster but does not log individual row deletions, making rollback impossible in most cases. D) REMOVE : This is not a valid SQL command. E) UPDATE : The UPDATE command is used to modify existing data, not to delete it.
Which two organizations partnered to provide easier loans for rooftop solar panel installation and EV charging stations?
Where was a dhole (Cuon alpinus) recently photo-captured in India, indicating its return?Â
What percentage of India’s digital payments were processed through UPI in 2024?
The University of _______ and advertising agency Rediffusion to launch 'The Bharat Lab' to provide opportunities for faculty and students to exchange kn...
Incentives paid by the government to banks for promoting RuPay debit cards and low-value BHIM-UPI transactions will not attract _______.
The Rashtriya Gokul Mission, which has played a vital role in increasing India's milk production, contributed to an increase in milk production by what ...
- What is India’s ranking in the World Happiness Report 2025?
DRDO conducted the first flight test of its LRLACM from the Integrated Test Range in Chandipur, Odisha, in November 2024. What is the full form of LRLACM?
What is the only change in the new ₹20 banknotes issued by RBI in 2025?
Under the CATCH Grant Program by IndiaAI and NCG, what is the maximum funding per project for AI innovations in cancer care?Â