SELECT
command
Retrieves rows from one or more tables. The most frequently used SQL statement.
Syntax
SELECT column1, column2 FROM table WHERE condition ORDER BY col LIMIT n;
Example
sql
-- Basic select
SELECT * FROM users;
-- Specific columns with condition
SELECT id, name, email
FROM users
WHERE active = 1
ORDER BY name ASC
LIMIT 10;
-- With alias
SELECT first_name AS name, email AS contact
FROM users;