(iii) Delete the record of Supervisors who have salary greater than 25000
Answer
Answer by student:
DELETE FROM Personal
WHERE Desig = "Superviser" AND Salary > 25000;
Detailed answer by teachoo:
-
The question asks us to write a SQL query to delete the record of Supervisors who have salary greater than 25000. To do this, we use the
DELETE
statement, which removes data from a table. The syntax of the DELETE statement is:
DELETE FROM table_name WHERE condition;
- The table_name is the name of the table that we want to delete data from. In this case, it is Personal.
- The condition is an optional clause that specifies which rows to delete. If we omit the condition, all rows in the table will be deleted. In this case, we want to delete only those rows where Desig is “Superviser” and Salary > 25000.
- We use the = operator to check for equality and the > operator to check for greater than.
- We also use the AND operator to combine multiple conditions.
- The semicolon (;) is used to end the SQL statement.
So, the SQL query to delete the record of Supervisors who have salary greater than 25000 is:
DELETE FROM Personal
WHERE Desig = "Superviser" AND Salary > 25000;