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
salaryINTEGERlast_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.
| salary | last_name | first_name |
|---|---|---|
| 120000 | Smith | John |
| 85000 | Johnson | Alice |
| 80000 | Wilson | Bob |
| 60000 | Davis | Carol |
| 70000 | Brown | David |
| 95000 | Taylor | Emma |
| 65000 | Green | Frank |
| 90000 | White | Grace |
| 55000 | Clark | Henry |
| 68000 | Martinez | Ivy |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Build the next SQL skill
WHERE Clause & Filtering
Practice SQL WHERE clauses with realistic boundary, NULL, text, date, exclusion, and production-filtering problems.
Basic SQL Functions
Practice production-oriented string cleanup, numeric transformations, NULL handling, tolerant conversion, and delimiter parsing.
ORDER BY & Sorting
Practice deterministic SQL ordering with tie-breakers, custom priorities, NULL placement, expressions, joined data, aggregates, and portable top-N patterns.
Open the interactive workspace and practice across SQL topics.