DEV Community

Sreekar Reddy
Sreekar Reddy

Posted on • Originally published at sreekarreddy.com

๐Ÿ“‹ SQL Explained Like You're 5

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'
Enter fullscreen mode Exit fullscreen mode

"Give me names and emails of Sydney customers"

INSERT (adding data):

INSERT INTO customers (name, email) VALUES ('Alice', 'alice@mail.com')
Enter fullscreen mode Exit fullscreen mode

"Add a new customer named Alice"

UPDATE (changing data):

UPDATE customers SET email = 'new@mail.com' WHERE name = 'Alice'
Enter fullscreen mode Exit fullscreen mode

"Change Alice's email"

DELETE (removing data):

DELETE FROM customers WHERE name = 'Bob'
Enter fullscreen mode Exit fullscreen mode

"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)