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.
√323.89 × (3.20) ÷ 9.02 = ?
In 2017, Sunny invested Rs 3500 at S.I and rest at C.I. If the total amount received after respective time is Rs 8960, then find the time for which the ...
In 2015, the difference between compound interest and simple interest for the given time is Rs 20. If the sum is invested for 3 years, what will be the ...
What is the percentage profit (approximate) on selling dates if its selling price is 120% of the selling price of Raisins?
If number of staff members in Patna is 10% less than number of staff members in Chandigarh,in which city the total staff members who work in Credit depa...
If the percentage of profit on selling Almonds is 25%, then what is its cost of packaging?
In 2014, if rate of interest is increased by 3%, what will be the amount received after given time?
If the total number of persons who attended the workshop in 2016 is 324, then what is the total number of Professors who attended the workshop in all t...
In 2016, the interest was semi-annually, the interest would have been Rs 1030.402 for given time. Find the interest when compounded annually.
In 2013, the amount becomes Rs 28,700 after 8 years, find the rate of interest.