SELECT Without FROM
Return 1 + 1 as result.
Interview brief
Understand the request
Support engineer A quick runtime check needs a one-row calculation without reading a table.
Some engines let you run a SELECT with no FROM clause to evaluate a literal expression. Return a single row with one column called result whose value is 1 + 1.
Return
- Return one column named result with the value 2.
Constraints
- Do not use a FROM clause on engines that support direct expression evaluation.
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
You do not need any table for this one. Most engines accept SELECT followed only by an expression list.
Hint 2
Just write the arithmetic and alias the column.
Hint 3
Project the arithmetic expression directly, give it the requested alias, and omit the FROM clause.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT 1 + 1 AS result;Why this works
A SELECT without FROM is the SQL equivalent of a calculator. PostgreSQL, MySQL, SQLite, and SQL Server all allow it. Oracle is the famous exception — it requires a FROM clause, so you use the special one-row table DUAL.
Expected result
Use this output to verify values, aliases, ordering, and row count.
| result |
|---|
| 2 |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics: