Question · SQL and MySQL course · Module 1: Introduction to databases

Selecting specific columns

How do you retrieve only chosen columns instead of all of them?

Answer options

  • You always have to use the asterisk *
  • List the column names separated by commas instead of the asterisk: SELECT tytul, autor_id FROM ...
  • Write the column names in square brackets
  • You can't - SELECT only ever returns all columns
Show the answer

Correct answer:

  • List the column names separated by commas instead of the asterisk: SELECT tytul, autor_id FROM ...