SELECT with Expressions
Return employee names with bonus calculated as salary * 0.10.
Exercise brief
Understand the request
Finance analyst The compensation preview needs a proposed bonus equal to ten percent of salary.
For every employee, add a calculated column called bonus that is 10% of their salary (i.e. salary * 0.10). Show first_name, last_name, salary, and bonus.
Return
- Return first_name, last_name, salary, and bonus.
Constraints
- Use an arithmetic expression in the SELECT list.
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
You can put arithmetic right inside the SELECT list. Multiply the salary column by a literal 0.10 and give it an alias.
Hint 2
Syntax: SELECT col, col * <number> AS <alias> FROM table;
Hint 3
Add salary multiplied by the decimal bonus rate as the fourth projected expression and name it bonus.
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, salary * 0.10 AS bonus FROM employees;Why this works
A SELECT list item can be any scalar expression, not just a column name. The new column exists only in the result — it is computed on the fly. The alias `bonus` gives that computed column a name in the output.
Success check
Every employee appears once and bonus equals salary multiplied by 0.10.
Expected result
Use this output to verify values, aliases, ordering, and row count.
| first_name | last_name | salary | bonus |
|---|---|---|---|
| John | Smith | 120000 | 12000 |
| Alice | Johnson | 85000 | 8500 |
| Bob | Wilson | 80000 | 8000 |
| Carol | Davis | 60000 | 6000 |
| David | Brown | 70000 | 7000 |
| Emma | Taylor | 95000 | 9500 |
| Frank | Green | 65000 | 6500 |
| Grace | White | 90000 | 9000 |
| Henry | Clark | 55000 | 5500 |
| Ivy | Martinez | 68000 | 6800 |
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.