With SQL, how do you select a column named "FirstName" from a table named "Persons"?

  1. EXTRACT FirstName FROM Persons

  2. SELECT FirstName FROM Persons

  3. SELECT Persons.FirstName

  4. SELECT * FROM Persons


Correct Option: B

AI Explanation

To select a column named "FirstName" from a table named "Persons" in SQL, you would use the following query:

B. SELECT FirstName FROM Persons

Option A) EXTRACT FirstName FROM Persons - This option is incorrect because the EXTRACT keyword is used to extract specific parts of a date or time, not to select columns from a table.

Option B) SELECT FirstName FROM Persons - This option is correct. It uses the SELECT keyword to specify the column "FirstName" and the FROM keyword to specify the table "Persons".

Option C) SELECT Persons.FirstName - This option is incorrect because it uses the table name "Persons" as a prefix to the column name "FirstName". In SQL, the correct syntax is to specify the column name directly after the SELECT keyword.

Option D) SELECT * FROM Persons - This option is incorrect because it uses the asterisk (*) symbol to select all columns from the table "Persons". To select only the "FirstName" column, you need to specify it explicitly as shown in option B.

The correct answer is B. This option is correct because it uses the correct syntax to select the "FirstName" column from the "Persons" table.

Find more quizzes: