With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

  1. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

  2. SELECT FirstName='Peter', LastName='Jackson' FROM Persons

  3. SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

  4. SELECT * FROM Persons WHERE FirstName='Jackson' AND LastName='Peter'


Correct Option: A

AI Explanation

To select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson", you would use the SQL query:

A. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

Explanation: Option A) SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson' - This option is correct because it uses the "SELECT" statement to retrieve all columns ("*") from the "Persons" table where the "FirstName" is equal to "Peter" and the "LastName" is equal to "Jackson".

Option B) SELECT FirstName='Peter', LastName='Jackson' FROM Persons - This option is incorrect because it uses the "SELECT" statement incorrectly. The column names should be specified after the "SELECT" keyword, not the values.

Option C) SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson' - This option is incorrect because it uses the "NOT EQUAL TO" operator "<>" instead of the "EQUAL TO" operator "=" to filter the records by "FirstName" and "LastName".

Option D) SELECT * FROM Persons WHERE FirstName='Jackson' AND LastName='Peter' - This option is incorrect because it swaps the values for "FirstName" and "LastName" in the query. The correct query should be "FirstName='Peter' AND LastName='Jackson'".

Therefore, the correct answer is A) SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'.

Find more quizzes: