Use a Table Alias
Alias employees as e and return e.first_name with e.salary.
Exercise brief
Understand the request
Data engineering apprentice The query will soon join more tables, so the source needs a concise alias now.
Return e.first_name and e.salary after giving the employees table the alias `e`. Table aliases are essential once queries grow to multiple tables.
Return
- Return first_name and salary.
Constraints
- Qualify both projected columns with the table alias.
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
employees
first_nameVARCHAR(50)salaryINTEGER
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
Add `AS e` (or just ` e`) right after the table name in FROM. Once aliased, you must use the alias to qualify columns (e.first_name).
Hint 2
Most engines let you skip the AS keyword: `FROM employees e` is equivalent to `FROM employees AS e`.
Hint 3
Introduce a short alias after employees and use that alias to qualify both projected columns.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT e.first_name, e.salary FROM employees AS e;Why this works
Table aliases shorten table names and disambiguate columns when multiple tables share a column name (e.g. id). Even in single-table queries, aliasing is a good habit because it makes the query trivial to extend with JOINs later.
Success check
Every employee appears once with first_name and salary projected through the e table alias.
Expected result
Use this output to verify values, aliases, ordering, and row count.
| first_name | salary |
|---|---|
| John | 120000 |
| Alice | 85000 |
| Bob | 80000 |
| Carol | 60000 |
| David | 70000 |
| Emma | 95000 |
| Frank | 65000 |
| Grace | 90000 |
| Henry | 55000 |
| Ivy | 68000 |
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.