SELECT Statements SQL Topic exerciseEasyVerified answerSQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

Reorder the Projected Columns

Return salary, last_name, and first_name in that exact left-to-right order.

Exercise brief

Understand the request

Payroll export specialist A downstream file requires salary before employee identity fields.

Show salary, last_name, and first_name — in that order — for every employee. The result should have those three columns left-to-right.

Return

  • Return exactly three columns: salary, last_name, and first_name.

Constraints

  • Control presentation order through the SELECT list.

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

employees

  • salaryINTEGER
  • last_nameVARCHAR(50)
  • first_nameVARCHAR(50)

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

The SELECT list controls both **which** columns appear and **in what order** they appear.

Hint 2

You do not need to change anything in the table — just list the columns in the order the prompt asked for.

Hint 3

Write the SELECT list left-to-right exactly as the requested output should appear.

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT salary, last_name, first_name FROM employees;

Why this works

Projection order is purely a presentation concern. Reordering columns in SELECT does not affect the table or the rows; it only changes how the result set is laid out — useful when you are exporting to CSV or feeding a downstream report that expects a specific column order.

Success check

Every employee appears once with salary, last_name, and first_name in that exact column order; row order is not assessed.

Expected result

Use this output to verify values, aliases, ordering, and row count.

salarylast_namefirst_name
120000SmithJohn
85000JohnsonAlice
80000WilsonBob
60000DavisCarol
70000BrownDavid
95000TaylorEmma
65000GreenFrank
90000WhiteGrace
55000ClarkHenry
68000MartinezIvy

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Practice Online

Open the interactive workspace and practice across SQL topics.