Complete the code to delete rows from the table and return the deleted rows.
DELETE FROM employees WHERE department = 'Sales' [1];
The RETURNING clause in PostgreSQL allows you to return the deleted rows immediately after deletion.
Complete the code to delete employees older than 60 and return their names.
DELETE FROM employees WHERE age > 60 [1] name;
Use RETURNING followed by the column name to get specific columns from deleted rows.
Fix the error in the DELETE statement to correctly return the deleted rows.
DELETE FROM orders WHERE order_date < '2023-01-01' [1];
PostgreSQL uses RETURNING * to return all columns of deleted rows.
Fill both blanks to delete products with zero stock and return their id and name.
DELETE FROM products WHERE stock = 0 [1] id, [2];
Use RETURNING followed by the columns you want to return, separated by commas.
Fill all three blanks to delete customers from 'Canada' and return their name and email.
DELETE FROM customers WHERE country = 'Canada' [1] [2], [3];
Use RETURNING followed by the columns you want to return, separated by commas.