Getting Started Lesson 3 of 21
SQL SELECT — Choosing Columns
Read data with SELECT and FROM, choose specific columns, compute new columns with math, and follow SQL's formatting rules.
SELECT is the command you'll use most. It reads data from a table and shows it as a result table. You choose which columns you want, and later lessons show how to choose which rows.
Syntax
SELECT column1, column2, ...
FROM table_name;
Selecting all columns
SELECT * FROM customers;
The asterisk * means "all columns". It's convenient for exploring, but in real applications you should list only the columns you need. It's faster and clearer.
Selecting specific columns
SELECT name, price FROM products;
Columns appear in the order you list them. Try SELECT price, name, stock FROM products;.
Calculations
You can compute new values in a SELECT. These don't change the table; they're only in the result:
SELECT name, price, stock, price * stock
FROM products;
price * stock is how much money all of that item on the shelf is worth. You can use +, -, *, / and parentheses, just like in math.
Naming computed columns with AS
The column title price * stock is ugly. Give it a name with AS:
SELECT name,
price AS old_price,
price * 1.10 AS new_price
FROM products;
A name given with AS is called an alias. There's a whole lesson on aliases later.
Joining text
In SQLite and standard SQL, || joins text together:
SELECT first_name || ' ' || last_name AS full_name, grade, section
FROM students;
In MySQL, you'd write CONCAT(first_name, ' ', last_name) instead.
SQL formatting rules
- Keywords aren't case-sensitive:
SELECT,selectandSelectall work. Writing keywords in UPPERCASE is a common habit because it makes queries easier to read. - Spaces and new lines don't matter: put each part (SELECT, FROM, WHERE…) on its own line for readability.
- End each statement with a semicolon
;. It's required when running several statements together. - Text values use single quotes:
'Bread', not"Bread".
Comments in SQL
-- This is a single-line comment
SELECT name, stock /* a comment can go here too */
FROM products;
Running more than one query
Separate queries with semicolons. Our editor shows each result one after another:
SELECT name FROM customers;
SELECT name FROM products;
Quick Quiz
Check what you learned. Walang grade ito, practice lang. 🙂
By Sir Reyel · Last updated 2026-12-04