Speaking the language databases understand
Day 65 of 149
๐ Full deep-dive with code examples
The Restaurant Order Analogy
At a restaurant, you tell the waiter:
- "I'd like the pasta" โ SELECT
- "Add extra cheese" โ INSERT
- "Change my drink to water" โ UPDATE
- "Cancel the dessert" โ DELETE
SQL is how you tell databases what you want!
It's the language for asking questions and giving instructions.
What SQL Does
SQL (Structured Query Language) lets you:
- Ask questions โ Find all customers from Sydney
- Add data โ Insert a new order
- Change data โ Update a customer's address
- Remove data โ Delete an old record
All in simple, readable commands.
The Basic Commands
SELECT (reading data):
SELECT name, email FROM customers WHERE city = 'Sydney'
"Give me names and emails of Sydney customers"
INSERT (adding data):
INSERT INTO customers (name, email) VALUES ('Alice', 'alice@mail.com')
"Add a new customer named Alice"
UPDATE (changing data):
UPDATE customers SET email = 'new@mail.com' WHERE name = 'Alice'
"Change Alice's email"
DELETE (removing data):
DELETE FROM customers WHERE name = 'Bob'
"Remove Bob from the database"
Why SQL Matters
- Universal โ Most databases use it
- Readable โ Almost like English
- Powerful โ Complex queries possible
- Been around forever โ Lots of tools and knowledge
Key Concepts
- Tables โ Like spreadsheets with rows and columns
- Rows โ Each entry (one customer, one order)
- Columns โ The properties (name, email, date)
- Queries โ Questions you ask the database
In One Sentence
SQL is the simple, English-like language for asking databases to find, add, update, or delete data.
๐ Enjoying these? Follow for daily ELI5 explanations!
Making complex tech concepts simple, one day at a time.
Top comments (0)