🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

SQL – SELECT

The SELECT statement is the foundation of every SQL query — learn to retrieve exactly the data you need.

The SELECT statement is the most important tool in your SQL toolkit. It lets you retrieve data from one or more columns in a table. You can select everything with SELECT *, or be precise and list only the columns you actually need. Being specific is almost always better — it is faster, uses less memory, and makes your queries self-documenting.

Think of SELECT like placing a custom order at a restaurant. Instead of saying “give me everything on the menu,” you say exactly what you want: “I’ll have the name, city, and score — nothing else.”

SELECT variations

SELECT *                  -- All columns (use sparingly)
SELECT name, score         -- Specific columns
SELECT name AS student     -- Column with alias
SELECT UPPER(name)         -- Apply a function

Try It Yourself — Interactive SQL Editor

Edit the query below and click Run Query ▶ to see live results powered by SQLite running directly in your browser.

SQLite – edit & run
Results
← Click Run Query ▶ to see results

Key Points

  • SELECT is read-only — it never changes your data
  • List specific columns instead of * for better performance
  • Column order in SELECT determines output column order
  • You can use expressions: SELECT price * 0.9 AS discounted_price

Pro Tip from CodesCompiler: The best way to learn SQL is to break things intentionally — modify the query above, change the WHERE conditions, try different columns. Every error teaches you something the docs cannot.

In the next lesson, we continue exploring SQL’s powerful feature set to build your database mastery.