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

SELECT Specific Columns

Return first_name, last_name, and salary from employees.

Exercise brief

Understand the request

Compensation coordinator The review sheet only needs employee names and current salary, not the full row.

Return only three columns from the employees table — first_name, last_name, and salary — in that exact order.

Return

  • Return first_name, last_name, and salary only.

Constraints

  • Use column projection instead of SELECT *.

Data you will use

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

employees

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

Hints, when you need them

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

Hint 1

List the columns you want after SELECT, separated by commas. The order in the SELECT list is the order they appear in the result.

Hint 2

Syntax: SELECT col1, col2, col3 FROM table;

Hint 3

Build a three-column SELECT list in the requested order, then add the employees table.

Verified SQL answer

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

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

Why this works

Listing columns explicitly is called "projection". It returns only the data you need, makes the result easier to read, and protects your query from breaking when extra columns are added to the table later.

Success check

Every employee appears once with only first_name, last_name, and salary in the requested column order; row order is not assessed.

Expected result

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

first_namelast_namesalary
JohnSmith120000
AliceJohnson85000
BobWilson80000
CarolDavis60000
DavidBrown70000
EmmaTaylor95000
FrankGreen65000
GraceWhite90000
HenryClark55000
IvyMartinez68000

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.