"Say goodbye to confusion โ start writing SQL queries with total clarity."


Table to Contents - Day 1
Introduction to SQL
Understanding Databases
Getting Started with SQL
Basic SQL Commands
1.Introduction to SQL
SQL = Structured Query Language
So, what is SQL?
Wellโฆ imagine you walk into a library ๐ where millions of books are stored (like data), and instead of searching by hand, you simply ask a robot:
โHey, give me all the books written by J.K. Rowling between 1997 and 2007.โ
Boom! The robot fetches your answer in a second.
Thatโs SQL.
Itโs the language you use to talk to databases โ to ask questions, pull out info, update records, or even delete stuff (carefully! ๐
).
Why is SQL Important?
Think of raw data like a bag of coffee beans โโ full of potential but not very useful on its own.
SQL is your espresso machine ๐ฅ๏ธ โ helping you brew strong, rich insights to keep your decision-making sharp and energized.
SQL: Because plain data is too bitter without the right filter ๐
Where Does SQL Fit in the Data World?
SQL is at the very core of data work.
Before you make charts in Power BI, build models in Python, or predict the future with AIโฆ
You need to get the data. Clean the data. Understand the data.
And guess what? Youโll likely be using SQL to do all that. ๐ฏ
2.Understanding Databases
Where Your Data Actually Lives - Dude Okay, so imagine your brain trying to remember everyoneโs birthday, their favorite food, and what they bought last week...
Now imagine doing that for millions of people. ๐ต
Youโd explode.
Thatโs where databases come in โ theyโre like super-organized digital brains that never forget. ๐ง ๐พ
๐ก Whatโs a Database?
A database is just a fancy place where data is stored in a neat and structured way.
Like a spreadsheet โ but smarter, faster, and doesnโt crash when your cousin pastes 10,000 rows of pizza orders. ๐
๐งณ Why Do We Need It?
To store lots of information (names, orders, passwords, cat pics ๐ฑ)
To find stuff fast (like โshow me all users from Bangaloreโ)
To update things easily (change your name from "Rshma" to "Reshma" ๐ )
To keep it all safe and sound (so hackers canโt just yoink it)
๐ฆ Real-Life Example
Imagine you're booking a flight on an app like MakeMyTrip or Indigo. โ๏ธ
You enter your name, choose your destination, select a seat, and pay online. ๐ณ
Where does all that info go?
Yup โ into a database!
Behind the scenes, the airline has tables like:
passengers
flights
bookings
payments
seat_map
Each table is like a section in a super-organized filing cabinet ๐๏ธ โ
and SQL is the friendly assistant who knows exactly where your aisle seat is! ๐
Think of it as a giant digital brain that remembers everything โ
so you donโt end up on a middle seat in row 42. ๐
๐ค So... Where Does SQL Fit?
SQL is the language you use to talk to these databases.
Itโs how you say things like:
โHey database, give me all the customers who love pineapple pizza.โ ๐๐
And the database replies with a list โ fast, friendly, and accurate.
3.Getting started with SQL
๐พ Where and How to Write SQL
Think of SQL as chatting with your database. You type in a question ("query") and it gives you answers (data)!
You donโt write SQL in Word or Notepad ๐ โ you need a special tool, called a SQL editor, to connect to your database and write queries.
Popular Tools: MySQL Workbench, PostgreSQL, SQLite, DB Fiddle., etc
4.Basic SQL commands
Database software (DBMS/RDBMS): This is the main software used to manage and organize data.
Examples: MySQL, PostgreSQL, Oracle, SQL Server
Databases: A database is a container that holds schemas, tables, and data.
Schemas: Itโs a logical container within the database that can hold table, views, functions, etc.. and in simple terms we can say it as collection of tables. In mysql workbench both database and schema are similar only
Tables: A table is where actual data stored in rows and columns
Data: Storing The actual values stored inside tables.
DBMS (MySQL, PostgreSQL)
โโโ ๐๏ธ Database (e.g. airline_db)
โโโ ๐ Schema (e.g. public)
โโโ ๐ Table (e.g. bookings)
โโโ ๐งพ Data (rows + columns)
Image of MYSQL workbench where you will see these,
Creating Schema using this query:
create schema by_query default character set utf8mb4 collate utf8mb4_general_ci;
Explanation:
by_query - Schema name
default character set utf8mb4: Default character set for the schema is utf8mb4
. The utf8mb4
character set is a Unicode character set that supports a wide range of characters, including emojis and symbols, by using up to four bytes per character.
collate utf8mb4_general_ci: This sets the default collation for the schema to utf8mb4_general_ci
. Collation determines how string comparison is performed. The utf8mb4_general_ci
collation is case-insensitive and is a general-purpose collation for the utf8mb4
character set.
Goal: Learn the real SQL commands that help you ask questions to your data.
๐ง Think of it like:
"Now that youโve found the kitchen (your database), itโs time to cook up some tasty SQL recipes!" ๐ณ๐จโ๐ณ
๐ต๏ธโโ๏ธ SELECT
โ Fetch the data you want
SELECT name FROM employees;
โ "Hey DB, give me all employee names."
๐ฆ
FROM
โ Tell SQL where to lookSELECT name FROM employees;
โ "I want data from the employees table."
๐ฏ
WHERE
โ Filter only what mattersSELECT * FROM employees WHERE department = 'Sales';
โ "Only show me employees from the Sales department."
๐งน
DISTINCT
โ Remove duplicatesSELECT DISTINCT city FROM customers;
โ "Give me a list of unique cities where customers live.โณ
LIMIT
โ Show fewer rows (great for big data sets)๐งโ๐ณ
ORDER BY
โ Sort your resultsSELECT name, age FROM users ORDER BY age DESC;
โ "Show users sorted by age, from oldest to youngest."
โณ
LIMIT
โ Show fewer rows (great for big data sets)SELECT * FROM orders LIMIT 10;
โ "Just give me the first 10 orders."
"
๐ก Pro Tip:
You can mix & match these commands like ingredients in a recipe:
SELECT name, salary FROM employees WHERE department = 'HR' ORDER BY salary DESC LIMIT 5;
"Give me the top 5 highest-paid HR employees."
Subscribe to my newsletter
Read articles from Reshma Sakthi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Reshma Sakthi
Reshma Sakthi
๐ Bug Hunter Turned Data Detective ๐ After 2+ years in software testing, I'm chasing insights instead of bugs. On a journey to become a data analyst โ Learning SQL, Python, Excel & dashboards (Power BI |Tableau) โ and blogging what I learn along the way!