Day 1 — Your first SQL query
SQL is how you ask a database a question. Today you will write your first one and get an answer back — in this very page, no software to install.
What SQL actually is
A database stores data in tables, which look a lot like Excel sheets: columns across the top, rows underneath. SQL (Structured Query Language) is the language you use to ask that database for the rows you want.
The important shift from Excel: you do not scroll and look. You describe what you want, and the database finds it — whether that is 8 rows or 8 million.
SELECT — choosing columns
Every query starts with SELECT (which columns) and FROM (which table).
The star * means "every column". Press Run — then change something and run it again.
Picking only the columns you need
In real work you rarely want every column. Listing them makes the result readable and the query faster.
Renaming a column with AS
AS gives a column a friendlier heading in the result. It changes nothing in the database.
Things that trip people up on day one
- SQL is not case sensitive for keywords.
selectandSELECTboth work. Most people write keywords in capitals so they stand out. - The semicolon
;ends a statement. Some tools need it, some do not. Get into the habit. - Text values go in single quotes:
'Noida'. Numbers do not:42000.
SELECT * is fine while exploring. In a report or a saved query, always list the columns — otherwise your report silently changes shape the day someone adds a column to the table.Try these yourself
- Show only the CustomerName column from Customers.
- Show ProductName and Price from Products.
- Show every column from Employees.
- Show Name from Employees with the heading Employee.
Want this taught properly?
This tutorial covers the basics. Our SQL course in Noida takes you through window functions, CTEs and stored procedures on a real database, with projects and mentor support.
See the SQL course →