SELECT and Column Expressions in SQL
By Owen Middleton · Updated September 2026 · Examples run on PostgreSQL 17
Builds toward WHERE Clause and Comparison Operators, Literal Values, Data Types, and Type Casting, ORDER BY and Result Sorting, Column Aliases and Expression Naming
What is SELECT in SQL?
SELECT is how you tell SQL what to compute and what to call the result.
You're already in SQL working on a query. Before running a commission calculation across thousands of deals, you want to verify the formula produces the right number on a known input. SELECT lets you test the arithmetic in isolation — write the expression, give it a label, and SQL evaluates it immediately.
How do you use SELECT without a table?
Before you ever touch a table or pull from a database, SELECT already does useful work. You hand it any arithmetic expression — addition, subtraction, multiplication, division — and it hands back a labeled answer. The AS keyword handles the labeling. You write the expression, write AS, then give the column a name:
SELECT 48000 * 0.075 AS commission_amountSQL evaluates the expression and returns one row with one column: commission_amount, value 3600. One query, one result. That's it.
You can return several calculations at once by separating them with commas:
SELECT 48000 AS deal_value, 0.075 AS commission_rate, 48000 * 0.075 AS commission_amountOne query, one row, three labeled columns. If someone needs the full breakdown — the deal size, the rate, and the dollar amount — you return all three together.
Which arithmetic operators can you use in SELECT?
SELECT works with all four arithmetic operators: +, -, *, and /. Parentheses control the order of operations, exactly like in regular math:
SELECT (320 - 50) * 1.10 AS final_totalWithout the parentheses, SQL multiplies first and you get a different number. With them, the subtraction happens first. Whenever a calculation has multiple steps, parentheses make the order explicit and keep the result from surprising you.
SELECT 43 / 8
Why does 43 / 8 return 5 in SQL?
The one thing that trips people up: integer division.
Divide two whole numbers and SQL drops the decimal entirely. 43 / 8 returns 5, not 5.375. Fix it by writing at least one side with a decimal point: 43.0 / 8 returns 5.375000. Any time you need the fractional part of a result, make sure at least one number in the division has a decimal.
What does SELECT 43 / 8 return?
Practice SELECT in SQL
Brightlane's merchandising team is evaluating margin on a new product line ahead of the spring catalog launch. One item in the line sells for $149.99 and carries a production cost of $89.50 per unit.
Write a query to return the gross profit per unit.
Output:
- A single row with one column,
gross_profit.
Run previews · Check grades
Write a query, then run it to see results here.
The full breakdown walks through the shape, each clause, why this approach beats the alternatives, and the trap to avoid.
See the full worked solutionStation Zero, our free browser SQL game, teaches this concept inside a story. No signup.
write your first SELECT in Station Zero9 SELECT practice problems
Write a query to return the gross profit per unit.
Write a query to return the total cost for a 12-month subscription.
Write a query to return both the discount amount and the resulting sale price.
Write a query to return the base salary, commission amount, bonus, and total compensation in a single row.
Write a query to return each charge alongside the total shipping cost in a single row.
Write a query to return the deal value, the commission rate as a decimal, and the commission amount in dollars in one row.
Write a query to return the balance after the credit, the platform fee amount, and the final total the customer owes.
Write a query to return the precise number of boxes per crate, including the fractional portion.
Write a query to return the final net payment amount.
Start learning to practice all 9 SELECT problems, with instant grading and mastery tracking.
Common questions about SELECT
Does SELECT decide which rows a query returns?
No. SELECT controls what each output row contains, not how many rows there are. Asking for one column or five returns the same number of rows either way. WHERE is the clause that decides which rows survive.
Does the order of columns in a SELECT list matter?
It sets the order of the columns in the result and nothing else. Swap two expressions and the two output columns swap with them, while every value stays the same. The order the rows arrive in is a separate question, answered by ORDER BY.
Can one SELECT return several calculations at once?
Yes. Separate the expressions with commas and each becomes its own labelled column in the same row. One query can hand back the deal value, the rate and the commission together, which is more useful to the person asking than three separate answers.
Is SQL case sensitive?
Keywords are not, so select and SELECT do the same thing. Unquoted names are folded to lower case, which is why an alias written as MonthlyRevenue comes back as monthlyrevenue. Wrap a name in double quotes and PostgreSQL keeps the capitals exactly as you typed them.