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

  1. SELECT FirstName FROM Persons

  2. EXTRACT FirstName FROM Persons

  3. SELECT Persons.FirstName

  4. SELECT * FROM Persons


Correct Option: A

AI Explanation

To select a column named 'FirstName' from a table named 'Persons' in SQL, you would use the SELECT statement. Let's go through each option to understand why it is correct or incorrect:

Option A) SELECT FirstName FROM Persons - This option is correct because it uses the SELECT statement to specify the column 'FirstName' that you want to retrieve from the table 'Persons'.

Option B) EXTRACT FirstName FROM Persons - This option is incorrect. The EXTRACT keyword is used to extract parts of a date or time value, not for selecting columns from a table.

Option C) SELECT Persons.FirstName - This option is incorrect. Although it specifies the desired column 'FirstName', it is missing the keyword FROM, which is necessary to indicate the table 'Persons' from which to retrieve the column.

Option D) SELECT * FROM Persons - This option is incorrect. The asterisk (*) symbol is used to select all columns from a table. It does not specifically select only the 'FirstName' column.

The correct answer is A) SELECT FirstName FROM Persons. This option is correct because it uses the SELECT statement to specify the 'FirstName' column from the 'Persons' table.

Find more quizzes: