SELECT is the first word of almost every SQL query — it’s how you read data. You name the columns you want and the table they live in, and the database hands back the rows. Everything else — filtering, sorting, joining — hangs off this one statement. This guide gets you querying immediately.
The playground below runs a real SQL engine in your browser against a small sample database. Change the columns, press Run, and see the result.
Try it — pick your columns
Sample tables you can query
Quick answer: what does SELECT do?
SELECT retrieves rows from a table. You list the columns you want, then the table:
SELECT column1, column2
FROM table_name;The database returns those columns for every row in the table (until you add a WHERE filter to narrow it down).
Select specific columns — or all of them with *
Name the columns you want, separated by commas, and you get exactly those:
SELECT name, price
FROM products;The asterisk * is shorthand for “every column”:
SELECT *
FROM products;* is handy while exploring, but in real queries it’s better to list the columns you actually need — you pull less data, the intent is clearer, and your query won’t silently change shape when someone adds a column to the table.
Specific columns vs. *
Sample tables you can query
Rename columns with AS
Give a column a friendlier name in the output using AS. It changes only the result heading, not the underlying data:
SELECT name AS product, price AS usd
FROM products;Aliases are great for readable reports and become essential once you start combining tables. (The AS keyword is optional in most databases — price usd also works — but writing it out is clearer.)
Remove duplicates with DISTINCT
SELECT DISTINCT collapses repeated rows down to the unique ones. Ask for the categories in the products table and you don’t want the value “Electronics” listed once per product — you want each category once:
SELECT DISTINCT category
FROM products;DISTINCT and AS
Sample tables you can query
Sort the results with ORDER BY
By itself, SELECT returns rows in no guaranteed order. ORDER BY sorts them — ascending (ASC, the default) or descending (DESC):
SELECT name, price
FROM products
ORDER BY price DESC;Sort with ORDER BY
Sample tables you can query
Put it together and you can filter, sort, and shape a result in one statement: SELECT the columns, FROM the table, WHERE the condition holds, ORDER BY a column.
Practice
Return the list of countries our customers are in, with no duplicates. Select just the country column.
Sample tables you can query
Return every product with two columns renamed: the name as "product" and the price as "usd".
Sample tables you can query
Frequently asked questions
What does the SELECT statement do in SQL? It retrieves rows from a table. You list the columns you want after SELECT and the table after FROM; the database returns those columns for the matching rows.
What’s the difference between SELECT * and naming columns? * returns every column; naming columns returns only those. Prefer naming columns in production queries — less data, clearer intent, and stable output when the table changes.
How do I remove duplicate rows in SQL? Use SELECT DISTINCT. It returns only the unique combinations of the selected columns.
How do I sort SQL query results? Add ORDER BY column — ASC for ascending (the default), DESC for descending. You can sort by multiple columns: ORDER BY category, price DESC.
Where to go next
You can now read data. To filter it, add a WHERE clause; to understand the table source, see the FROM clause; to limit how many rows come back, use SELECT TOP / LIMIT.
And when reading data turns into moving and reshaping it across many sources, ET1 turns each SELECT into a visual node on a canvas — pick your columns, preview the rows, wire it to the next step, no boilerplate.