nerdexam
Linux_Foundation

LFCS · 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. The correct SQL statement to select multiple columns requires listing each column name separated by a comma after the SELECT keyword.

Submitted by ravi_2018· Apr 18, 2026Service Configuration

Question

Which of the following SQL statements will select the fields name and address from the contacts table?

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

(25 responses)
  • B
    8% (2)
  • C
    88% (22)
  • D
    4% (1)

Why each option

The correct SQL statement to select multiple columns requires listing each column name separated by a comma after the SELECT keyword.

ASELECT (name, address) FROM contacts;

Parentheses are not used to enclose a list of column names in a standard SQL SELECT statement, making the syntax incorrect.

BSELECT (name address) FROM contacts;

Parentheses are incorrectly used, and column names must be separated by commas, not spaces, in a standard SQL SELECT statement.

CSELECT name, address FROM contacts;Correct

The `SELECT name, address FROM contacts;` statement correctly uses commas to separate multiple column names, which is the standard SQL syntax for retrieving specific columns from a table. This syntax instructs the database to return values from both the 'name' and 'address' columns for all rows in the 'contacts' table.

DSELECT name address FROM contacts;

Column names must be separated by commas when selecting multiple columns; simply using a space is not valid SQL syntax for this purpose.

Concept tested: SQL SELECT statement syntax for multiple columns

Source: https://dev.mysql.com/doc/refman/8.0/en/select.html

Topics

#SQL#Database Query#SELECT statement

Community Discussion

No community discussion yet for this question.

Full LFCS Practice