Complete the code to remove all rows from the table quickly without logging individual row deletions.
TRUNCATE TABLE [1];The TRUNCATE TABLE command quickly removes all rows from a table named users without logging each row deletion.
Complete the code to delete rows from the table named 'orders' where the status is 'cancelled'.
DELETE FROM orders WHERE status = '[1]';
The DELETE statement removes rows matching the condition. Here, rows with status = 'cancelled' are deleted from the orders table.
Fix the error in the code to remove the entire table named 'products' from the database.
[1] TABLE products;The DROP TABLE command deletes the entire table structure and its data from the database.
Fill both blanks to write a command that deletes all rows from 'employees' but keeps the table structure intact.
[1] FROM employees WHERE [2];
The command DELETE FROM employees WHERE 1=1; deletes all rows because the condition 1=1 is always true, but the table remains.
Fill all three blanks to write a command that quickly removes all rows from 'logs' and resets identity counters if supported.
[1] TABLE [2] RESTART IDENTITY [3];
The command TRUNCATE TABLE logs RESTART IDENTITY CASCADE; quickly removes all rows, resets any auto-increment counters, and cascades the operation to dependent tables.