SQL Cheat Sheet/Select literals and expressions

Project computed values directly in the result set.

Section: SELECT Basics

Select literals and expressions

sql
sql
SELECT order_id, subtotal, tax, subtotal + tax AS total
FROM orders;
Explanation

Most SQL engines allow arithmetic, string, and function expressions in SELECT.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing SELECT Basics
Select all columns
Return all columns from a table.
OpenIn sheetsqlsame section
Select specific columns
Return only the columns you need.
OpenIn sheetsqlsame section
Select distinct values
Remove duplicate rows for the selected expression set.
OpenIn sheetsqlsame section
Use column aliases
Rename output columns in query results.
OpenIn sheetsqlsame section
Filter with equality
Return rows matching an exact value.
Sort rows
Order query results ascending or descending.