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 figure does not belong to the group in the following options?
The following question is based on the given diagram.
A, B, C, D, E and F live on six different floors of the same building. The lowermost floor in the building is numbered 1, the floor above it, number 2 a...
Statement: There is a large increase in migration of villagers to urban areas as repeated crop failure has put them into financial problems.
Co...
In the following question below are given some statements followed by some conclusions based on those statements. Taking the given statements to be tru...
In a group of 36 persons, a total of 16 take cold drink while 9 take only cold drink not green coconut drink How many persons in this group take only gr...
Select the set in which the numbers are related in the same way as are the numbers of the following set.
(NOTE : Operations should be performed...
Select the figure that will come next in the following figure-series.Â
In a certain code language, ‘GREAT’ is written as ‘ALYUN’. What will be the code for ‘RAPID’ in that code language?
Select the option that is related to the third word in the same way as the second word is related to the first word.
(The words must be considere...