SELECT Without FROM
Return 1 + 1 as result.
Exercise 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.
Success check
Exactly one row and one column named result are returned, with the numeric value 2 and no source table.
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:
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.