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.
Find the difference between angle and its complement if the angle is three-seventh of its complement.
A triangular field has sides 13 m, 14 m, and 15 m. A well with a diameter of 7 m is dug outside the field. If the entire soil dug from the well is used ...
If O is circumcentre of acute angled triangle ABC, if ∠ OBC = 150 then ∠BAC = ?
Find the area of triangle having sides in the ratio 3:5:7 & the perimeter of the triangle is 60 cm
If I is the incentre of ΔABC , if ∠BAC = 300 , then what is the measure of ∠BIC?
At the centre of a circle of 20 cm radius, the angle made by an arc of 24(4/9) cm length is
Orthocenter of an right angle triangle lies on
Angles of a triangle are in the ratio 3 : 5 : 10. Find the sum of the smallest and middle angle of the triangle.
The diagonals of a rectangle are inclined to one side of the rectangle at 25°. The acute angle formed between the diagonals is: