LU07.S04 - DELETE

Sarah Johnson has left the company and is therefore to be deleted from the table. Formulate the according DML DELETE statement.

DELETE FROM employees
WHERE name = 'Sarah'
AND surname = 'Johnson';

Alternatively, the commands is likewise possible with using the employee_id.

DELETE FROM employees
WHERE employee_id = 4;

It is common, that we retire when reaching a certain age. Remove all date from individuals who are older than 60 from the employees table.

Hint: Before performing the deletion, make sure that you got the right resultset.

Content of the table before deleting the concerned resultset:

SELECT * FROM employees
WHERE birthdate < '1964-01-01';
DELETE FROM employees
WHERE birthdate < '1964-01-01';

The result is visible in the next image below:

English German

Volkan Demir

  • modul/m290/learningunits/lu07/loesungen/l04.txt
  • Zuletzt geändert: 2024/10/01 12:00
  • von vdemir