SELECT is the statement used to "read" data from a database. It's also the first command you should get comfortable with when learning SQL.
Common patterns
• SELECT * — show every column
• SELECT column1, column2 — show only the columns you want
• AS — give the output column a readable alias
Best practice
In reports, APIs, and dashboards, avoid * and select only the columns you actually need. Less data to move, and the query results are easier to read.
sql
SELECT CustomerName AS Name, City, Country
FROM Customers;You should see
+--------------------+-------------+---------+ | Name | City | Country | +--------------------+-------------+---------+ | Alfreds Futterkiste| Berlin | Germany | | Ana Trujillo | Mexico City | Mexico | | Antonio Moreno | Mexico City | Mexico | | Around the Horn | London | UK | +--------------------+-------------+---------+ What this code does: It selects only the customer name, city, and country, and displays CustomerName as Name in the output. Common mistake: Misspelling a column name can cause an "unknown column" error.