Remove Low-Salary Employees
Mediumsql
Write a DELETE statement that removes every employee earning less than 60000. The checker runs SELECT id, name FROM employees ORDER BY id; afterward to see who remains.
sqlCREATE TABLE employees ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, department TEXT NOT NULL, salary INTEGER NOT NULL );
Sample data (this is the starting state before your statement runs):
sqlINSERT INTO employees (id, name, department, salary) VALUES (1, 'Asha', 'Engineering', 85000), (2, 'Rohan', 'Sales', 55000), (3, 'Neha', 'Marketing', 58000), (4, 'Vikram', 'Engineering', 72000);
Example 1
Input
(none)
Output
id name 1 Asha 4 Vikram
A targeted DELETE needs exactly the right WHERE clause. Reference: DELETE FROM employees WHERE salary < 60000;