Skip to content
SQLSimplified

beginner

The SELECT Statement

How to choose exactly which columns you want back from a table using SELECT.

4 min read

Explanation

Every SQL query that reads data starts with SELECT. It answers one simple question: which columns do you want to see? A table might have a dozen columns, but most of the time you only care about a few of them.

Take the products table in our store dataset:

idnamecategorypricestock
1Wireless MouseElectronics24.99150
2Yoga MatFitness19.5080

If you only need the product name and its price, there's no reason to pull back the stock and category columns too. SELECT lets you say exactly what you want.

Two ways to select

You can list specific column names, or use * to mean "every column." Both are valid — the right choice depends on what you're trying to do.

Syntax

The basic shape of a SELECT statement is:

SELECT column1, column2 FROM table_name;

To get every column in the table, use the wildcard * instead of listing names:

SELECT * FROM table_name;

The order of columns in your SELECT list controls the order they appear in the result — it doesn't have to match the order columns were defined in the table.

Interactive Example

Try selecting just a couple of columns from products, then compare it to selecting everything with *.

Store (Customers/Orders/Products)

Loading database engine...

Store (Customers/Orders/Products)

Loading database engine...

Common Mistakes

  • Using SELECT * out of habit in real projects. It's great for quickly exploring a table, but it can pull back far more data than you need and makes queries harder to reason about once tables grow more columns.
  • Misspelling a column name. If you type pric instead of price, the database will raise an error rather than silently guessing what you meant.
  • Forgetting that column order in the result follows your SELECT list, not the table's original column order.

Best Practices

  • Name the columns you actually need instead of reaching for *, especially once your queries are used in real applications.
  • List columns in the order that makes the result easiest to read — for example, put identifying columns like name before descriptive ones.
  • Keep queries on one or a few lines while you're learning; readability matters more than compactness.

Practice Question

Using the second playground above (on the customers table), rewrite the query so it returns only the name and city columns, in that order, instead of every column.

Summary

SELECT is how you tell SQL which columns to return. You can name columns explicitly for precise, efficient queries, or use * when you want to see everything a table holds. The column order in your query determines the column order in your results.

FAQ

Search

Search lessons, functions, examples, and practice problems