LX0-104 · Question #241
Which of the following SQL statements will select the fields name and address from the contacts table?
The correct answer is C. SELECT name, address FROM contacts. This question tests the basic SQL syntax for selecting multiple columns from a table.
Question
Options
- ASELECT (name, address) FROM contacts;
- BSELECT (name address) FROM contacts;
- CSELECT name, address FROM contacts;
- DSELECT name address FROM contacts;
How the community answered
(42 responses)- A2% (1)
- B5% (2)
- C90% (38)
- D2% (1)
Why each option
This question tests the basic SQL syntax for selecting multiple columns from a table.
Parentheses around the column list (name, address) are not standard SQL syntax for selecting multiple columns and would result in a syntax error.
Parentheses around the column list (name address) with no separator between column names is incorrect SQL syntax and would cause an error.
In SQL, multiple column names are listed after the SELECT keyword, separated by commas, to retrieve data from those specific columns. The FROM clause then specifies the table from which to retrieve the data.
Listing column names name address without a comma separator is incorrect SQL syntax for selecting multiple columns and would result in an error.
Concept tested: Basic SQL SELECT statement syntax
Source: https://learn.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql
Topics
Community Discussion
No community discussion yet for this question.