W3. SQL Delete Flashcards
Q: What is the purpose of the SQL DELETE statement?
A: To delete existing records from a table.
Q: What is the syntax for the DELETE statement with a condition?
DELETE FROM table_name WHERE condition;
Q: Why is the WHERE clause important in a DELETE statement?
A: It specifies which records to delete; omitting it deletes all records in the table.
Q: Write an example query to delete a customer named “Alfreds Futterkiste” from the “Customers” table.
DELETE FROM Customers WHERE CustomerName = 'Alfreds Futterkiste';
Q: How do you delete all records in a table without deleting the table itself?
DELETE FROM table_name;
Q: Write a query to delete all rows from the “Customers” table without removing the table structure.
DELETE FROM Customers;
Q: How do you delete a table entirely from the database?
A: Use the DROP TABLE statement.
Q: Write an example query to delete the “Customers” table completely.
DROP TABLE Customers;