SQL basics: how to talk to a database
SQL basics: how to talk to a database in plain English
Almost every application that stores data uses a database underneath. And almost every database understands SQL. Learning even the basics of SQL gives you the ability to look inside any system, extract exactly what you need, and understand how data is structured at its core.
SQL stands for Structured Query Language. It is the language you use to ask a database questions, insert new records, update existing ones, and delete data you no longer need. Despite being decades old, it is still one of the most in demand technical skills in 2026 and shows no sign of being replaced anytime soon.
How a database is structured
A relational database organizes data into tables. Think of each table like a spreadsheet with rows and columns. A row is a single record. A column is a specific attribute of that record.
For example, a users table might have columns for id, name, email, and created_at. Every user in the system is a row in that table. This structure sounds simple but it scales to handle billions of records in production systems used by millions of people.
Every table in a database works like a structured spreadsheet with rows and columns
The four commands you will use most
SELECT * FROM users;
-- Get specific columns and filter by condition
SELECT name, email FROM users
WHERE is_active = true;
-- Insert a new record
INSERT INTO users (name, email)
VALUES ('Mohamed', 'm@example.com');
-- Update an existing record
UPDATE users SET email = 'new@example.com'
WHERE id = 4821;
-- Delete a record
DELETE FROM users WHERE id = 4821;
Filtering and sorting data
The real power of SQL comes from how precisely you can filter and organize your results. You are not just grabbing all the data and sorting through it manually. You tell the database exactly what you want and it returns only that.
SELECT * FROM orders
WHERE status = 'completed' AND total > 100;
-- Sort results by a column
SELECT * FROM products
ORDER BY price DESC;
-- Limit how many rows come back
SELECT * FROM users
ORDER BY created_at DESC
LIMIT 10;
-- Count how many rows match a condition
SELECT COUNT(*) FROM users
WHERE country = 'Saudi Arabia';
Where SQL shows up in real work
- Backend developers use it to store and retrieve application data
- Data analysts use it to explore datasets and generate reports
- AI engineers use it to query training data and log model outputs
- Automation builders use it to read from and write to databases in their pipelines
- Product managers use it to answer business questions without waiting for a developer
SQLiteOnline.com lets you run SQL queries in your browser with no setup. W3Schools has an interactive SQL editor alongside its tutorials. And if you want a real database to experiment with, PostgreSQL is free to install and used in production by some of the largest companies in the world.
Key takeaways
- SQL is the universal language for talking to relational databases
- SELECT, INSERT, UPDATE, and DELETE cover the vast majority of real use cases
- Filtering with WHERE and sorting with ORDER BY are what make SQL genuinely powerful
- You can practice SQL right now in your browser with no installation required
Comments
Post a Comment
Let me know what you think in the comments