W3. SQL Delete Flashcards

1
Q

Q: What is the purpose of the SQL DELETE statement?

A

A: To delete existing records from a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Q: What is the syntax for the DELETE statement with a condition?

A
DELETE FROM table_name 
WHERE condition;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Q: Why is the WHERE clause important in a DELETE statement?

A

A: It specifies which records to delete; omitting it deletes all records in the table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Q: Write an example query to delete a customer named “Alfreds Futterkiste” from the “Customers” table.

A
DELETE FROM Customers 
WHERE CustomerName = 'Alfreds Futterkiste';
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q: How do you delete all records in a table without deleting the table itself?

A

DELETE FROM table_name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Q: Write a query to delete all rows from the “Customers” table without removing the table structure.

A

DELETE FROM Customers;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q: How do you delete a table entirely from the database?

A

A: Use the DROP TABLE statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Q: Write an example query to delete the “Customers” table completely.

A

DROP TABLE Customers;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly