25.1k views
4 votes
Write the SQL to remove all records from the Customer table where the lastname is Taylor and the phone area code is not 781.

a) DELETE FROM Customer WHERE lastname='Taylor' AND phone LIKE '781-%'
b) DELETE FROM Customer WHERE lastname='Taylor' AND phone NOT LIKE '781-%'
c) DELETE * FROM Customer WHERE lastname='Taylor' AND phone <> '781'
d) DELETE * FROM Customer WHERE lastname='Taylor' AND phone != '781'

User Dan Radu
by
6.9k points

1 Answer

1 vote

Final answer:

The correct SQL statement is: DELETE FROM Customer WHERE lastname='Taylor' AND phone NOT LIKE '781-%'.

Step-by-step explanation:

The correct SQL statement to remove all records from the Customer table where the lastname is Taylor and the phone area code is not 781 is:

DELETE FROM Customer WHERE lastname='Taylor' AND phone NOT LIKE '781-%'

This statement uses the DELETE command to remove records from the table.

The WHERE clause specifies the conditions for deleting the records: the lastname should be 'Taylor' and the phone should not start with '781-'.

User Ajevic
by
7.4k points