With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

  1. DELETE ROW FirstName='Peter' FROM Persons

  2. DELETE FROM Persons WHERE FirstName = 'Peter'

  3. DELETE FirstName='Peter' FROM Persons

  4. REMOVE FROM Persons WHERE FirstName = 'Peter'


Correct Option: B

AI Explanation

To delete records where the "FirstName" is "Peter" in the Persons table using SQL, you would use the DELETE statement along with the WHERE clause to specify the condition.

Let's go through each option to understand why it is correct or incorrect:

Option A) DELETE ROW FirstName='Peter' FROM Persons - This option is incorrect because the correct syntax for the DELETE statement is DELETE FROM table_name.

Option B) DELETE FROM Persons WHERE FirstName = 'Peter' - This option is correct because it follows the correct syntax for the DELETE statement. It specifies the table name as "Persons" and uses the WHERE clause to specify the condition "FirstName = 'Peter'".

Option C) DELETE FirstName='Peter' FROM Persons - This option is incorrect because the correct syntax for the DELETE statement is DELETE FROM table_name. Additionally, the condition should be specified using the WHERE clause.

Option D) REMOVE FROM Persons WHERE FirstName = 'Peter' - This option is incorrect because the correct keyword to use for deleting records in SQL is DELETE, not REMOVE. The correct syntax should be DELETE FROM table_name.

The correct answer is Option B. This option is correct because it uses the correct syntax for the DELETE statement and specifies the condition using the WHERE clause.

Find more quizzes: