@Codingdidi
9.18K subscribers
26 photos
7 videos
47 files
260 links
Free learning Resources For Data Analysts, Data science, ML, AI, GEN AI and Job updates, career growth, Tech updates
Download Telegram
Day 3: Filtering Data Using the `WHERE` Clause and Logical Operators (`AND`, `OR`, `NOT`)

Welcome to Day 3 of your SQL journey! πŸŽ‰

Yesterday, we learned about SQL data types and basic queries using `SELECT`. Today, we will take it further and learn how to filter data using the WHERE clause and logical operators (AND, OR, NOT).

By the end of this lesson, you’ll be able to retrieve specific data based on conditions! πŸš€

---

πŸ“Œ What is the `WHERE` Clause?

In real-world databases, tables contain thousands or even millions of records. If you only want to find specific data, you need a filtering method.

The WHERE clause allows us to retrieve only the records that match certain conditions instead of displaying the entire table.

πŸ“– Syntax:
SELECT column1, column2, ... 
FROM table_name
WHERE condition;

---

πŸ“Œ Using `WHERE` to Filter Data
Let’s take an example. We have a Students table with the following records:

| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |

---

1️⃣ Filtering Data with `WHERE` Clause

Example 1: Find all students who are 18 years old
SELECT * FROM Students WHERE Age = 18;

πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |

βœ… Explanation:
- The query only selects students where Age = 18.

---

2️⃣ Using `AND` Operator

The `AND` operator allows us to filter based on multiple conditions.

Example 2: Find students who are 18 years old AND have Grade A
SELECT * FROM Students WHERE Age = 18 AND Grade = 'A';


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |

βœ… Explanation:
- The query filters students who are both 18 years old AND have Grade A.

---

3️⃣ Using `OR` Operator

The `OR` operator allows us to filter if at least one condition is met.

Example 3: Find students who are either 18 OR 19 years old
SELECT * FROM Students WHERE Age = 18 OR Age = 19;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |

βœ… Explanation:
- The query selects students who are either 18 OR 19 years old.

---

4️⃣ Using `NOT` Operator

The `NOT` operator helps us find records that do NOT match a certain condition.

Example 4: Find students who are NOT 18 years old
SELECT * FROM Students WHERE NOT Age = 18;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|-----------|-----|-------|----------------|
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |

βœ… Explanation:
- The query excludes students who are 18 years old.

---

πŸ“Œ Combining `AND`, `OR`, and `NOT`

Example 5: Find students who are either Grade A OR Grade B, but NOT 18 years old
SELECT * FROM Students WHERE (Grade = 'A' OR Grade = 'B') AND NOT Age = 18;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|-----------|-----|-------|----------------|
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |

βœ… Explanation:
- The query selects students who have Grade A OR B.
- But it excludes students who are 18 years old.

---

πŸ“Œ Using Comparison Operators with `WHERE`
πŸ‘2❀1
| Operator | Meaning |
|----------|---------|
| = | Equals |
| != or <> | Not Equal |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |

Example 6: Find students older than 18 years
SELECT * FROM Students WHERE Age > 18;

πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|-----------|-----|-------|----------------|
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |

βœ… Explanation:
- The query selects students who are older than 18.

---

## 🎯 Task for Today
βœ… Write a query to find students who are exactly 19 years old.
βœ… Write a query to find students who are younger than 19.
βœ… Write a query to find students who are either 18 OR 20 years old.
βœ… Write a query to find students who are not Grade A.
βœ… Write a query to find students who are older than 18 AND have Grade B.

---

πŸ” Summary
βœ… WHERE filters records based on a condition.
βœ… AND requires both conditions to be met.
βœ… OR requires at least one condition to be met.
βœ… NOT excludes specific records.
βœ… We can combine multiple conditions using AND, OR, and NOT.

---

πŸ“Œ That’s it for Day 3! Tomorrow, we’ll learn about sorting data using `ORDER BY`, limiting results with `LIMIT`, and removing duplicates using `DISTINCT`. πŸš€


Share with Credit: https://t.me/codingdidi
πŸ’‘ Like & comment if you're excited for Day 4! 😊❀️
πŸ‘4
This is how you can learn everything:

1. 25 minutes of focused learning
2. 5 minutes break
3. 25 minutes of focused learning
4. 25 minutes break minimum
5. Optionally go back to step 1

You can complete this cycle 2 times max per day, and it works wonders.
πŸ‘4πŸ”₯1
Hi, all
Your inputs are helping me make this SQL series more informative.
Do comments your inputs. βœ…

Happy Learning 😊
Day 4: Sorting Data (`ORDER BY`), Limiting Results (`LIMIT`, `OFFSET`), and Removing Duplicates (`DISTINCT`)

Welcome to Day 4 of learning SQL! πŸŽ‰

Yesterday, we learned how to filter data using `WHERE` and logical operators (AND, OR, NOT). Today, we’ll take it a step further and learn how to:
βœ… Sort data using `ORDER BY`
βœ… Limit the number of results using `LIMIT` and `OFFSET`
βœ… Remove duplicate values using `DISTINCT`

By the end of this lesson, you’ll be able to organize and refine your query results efficiently! πŸš€

---

πŸ“Œ Sorting Data Using `ORDER BY`

πŸ”Ή Why Do We Need Sorting?
When you query a table, the results might appear in random order. If you want your data to be more organized and meaningful, you need to sort it based on a specific column.

πŸ“– Syntax:
SELECT column1, column2, ...
FROM table_name
ORDER BY column_name ASC/DESC;

- ASC (Ascending Order) β†’ Default, sorts from smallest to largest (A-Z, 0-9).
- DESC (Descending Order) β†’ Sorts from largest to smallest (Z-A, 9-0).

---

1️⃣ Sorting in Ascending Order (`ASC`)
Let’s use a Students table as an example:

| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |

Example 1: Sort students by Age (Ascending)
SELECT * FROM Students ORDER BY Age ASC;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |

βœ… Explanation:
- The records are sorted from youngest (18) to oldest (20).

---

2️⃣ Sorting in Descending Order (`DESC`)
Example 2: Sort students by Age (Descending)
SELECT * FROM Students ORDER BY Age DESC;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 3 | Alex Brown | 20 | A | 2021-07-10 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 1 | John Doe | 18 | A | 2023-09-01 |
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |

βœ… Explanation:
- The records are sorted from oldest (20) to youngest (18).

---

3️⃣ Sorting by Multiple Columns
If two students have the same age, you can sort further by another column, like Grade.

Example 3: Sort students by Age (Ascending), then by Grade (Ascending)
SELECT * FROM Students ORDER BY Age ASC, Grade ASC;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |
| 1 | John Doe | 18 | A | 2023-09-01 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |
| 3 | Alex Brown | 20 | A | 2021-07-10 |

βœ… Explanation:
- Students are sorted by Age (smallest first).
- If two students have the same age, they are sorted by Grade (A before C).

---

πŸ“Œ Limiting Results Using `LIMIT` and `OFFSET`

πŸ”Ή Why Do We Need `LIMIT`?
Imagine you have 1 million records, but you only need to see the top 5 results. The LIMIT clause helps restrict the number of rows returned by a query.

πŸ“– Syntax:
SELECT column1, column2, ... 
FROM table_name
ORDER BY column_name
LIMIT number;


Example 4: Get the Top 3 Youngest Students
SELECT * FROM Students ORDER BY Age ASC LIMIT 3;
πŸ‘1
πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|--------------|-----|-------|----------------|
| 4 | Sophia Johnson| 18 | C | 2023-01-20 |
| 1 | John Doe | 18 | A | 2023-09-01 |
| 2 | Emma Smith | 19 | B | 2022-08-15 |

βœ… Explanation:
- We only get 3 results instead of the full table.

---

πŸ“Œ Skipping Rows Using `OFFSET`

OFFSET is used with `LIMIT` to skip a specific number of rows before returning results.

πŸ“– Syntax:
SELECT column1, column2, ... 
FROM table_name
ORDER BY column_name
LIMIT number OFFSET number;


Example 5: Get the second and third youngest students (Skip the first one)
SELECT * FROM Students ORDER BY Age ASC LIMIT 2 OFFSET 1;


πŸ”Ή Output:
| Student_ID | Name | Age | Grade | Enrollment_Date |
|------------|-----------|-----|-------|----------------|
| 1 | John Doe | 18 | A | 2023-09-01 |
| 2 | Emma Smith| 19 | B | 2022-08-15 |

βœ… Explanation:
- The first student (Sophia Johnson, Age 18) is skipped, and the next 2 students are returned.

---

πŸ“Œ Removing Duplicates Using `DISTINCT`

πŸ”Ή Why Do We Need `DISTINCT`?
Sometimes, a column contains repeated values, and you only need unique values.

πŸ“– Syntax:
SELECT DISTINCT column_name FROM table_name;


Example 6: Get All Unique Grades
SELECT DISTINCT Grade FROM Students;


πŸ”Ή Output:
| Grade |
|-------|
| A |
| B |
| C |

βœ… Explanation:
- The query removes duplicate values from the Grade column.

---

🎯 Task for Today
βœ… Write a query to get the top 5 oldest students.
βœ… Write a query to list unique enrollment dates.
βœ… Write a query to get the second highest age student.

---

πŸ” Summary
βœ… ORDER BY sorts data (Ascending/Descending).
βœ… LIMIT restricts the number of rows returned.
βœ… OFFSET skips a specific number of rows.
βœ… DISTINCT removes duplicate values.

Tomorrow, we will learn SQL Aggregate Functions (`COUNT`, `SUM`, `AVG`, `MIN`, `MAX`). πŸš€


Share with Credit: https://t.me/codingdidi
πŸ’‘ Like & Comment if you're ready for Day 5! 😊❀️
πŸ‘6
Day 5: SQL Aggregate Functions (`COUNT`, `SUM`, `AVG`, `MIN`, `MAX`)

Welcome to Day 5 of learning SQL! πŸŽ‰

So far, we’ve learned how to filter, sort, limit, and remove duplicates in our SQL queries. Today, we will take it one step further by learning Aggregate Functions in SQL.

πŸ”Ή What Are Aggregate Functions?
Aggregate functions perform calculations on a group of rows and return a single value. These functions are useful when we want to summarize data, such as:
βœ… Counting the number of records (COUNT)
βœ… Finding the total sum (SUM)
βœ… Calculating the average (AVG)
βœ… Finding the minimum value (MIN)
βœ… Finding the maximum value (MAX)

Let’s go step by step! πŸš€

---

πŸ“Œ `COUNT()` – Counting the Number of Rows

πŸ”Ή Why Do We Need `COUNT()`?
We use COUNT() to find how many rows exist in a table or how many times a specific value appears.

πŸ“– Syntax:
SELECT COUNT(column_name) FROM table_name;

- COUNT(column_name): Counts non-null values in a specific column.
- COUNT(*): Counts all rows, including those with NULL values.

---

Example 1: Count the Total Number of Students
Consider this Students table:

| Student_ID | Name | Age | Grade | Fees_Paid |
|------------|---------------|-----|-------|----------|
| 1 | John Doe | 18 | A | 1000 |
| 2 | Emma Smith | 19 | B | 1200 |
| 3 | Alex Brown | 20 | A | 900 |
| 4 | Sophia Johnson | 18 | C | NULL |

SELECT COUNT(*) FROM Students;


πŸ”Ή Output:
| COUNT(*) |
|----------|
| 4 |

βœ… Explanation:
- This query counts all rows in the table.

---

Example 2: Count the Number of Students Who Paid Fees
SELECT COUNT(Fees_Paid) FROM Students;


πŸ”Ή Output:
| COUNT(Fees_Paid) |
|------------------|
| 3 |

βœ… Explanation:
- This query excludes NULL values in Fees_Paid.

---

πŸ“Œ `SUM()` – Adding Up Values

πŸ”Ή Why Do We Need `SUM()`?
SUM() calculates the total sum of numeric values in a column.

πŸ“– Syntax:
SELECT SUM(column_name) FROM table_name;


---

Example 3: Find the Total Fees Paid
SELECT SUM(Fees_Paid) FROM Students;


πŸ”Ή Output:
| SUM(Fees_Paid) |
|---------------|
| 3100 |

βœ… Explanation:
- The sum of 1000 + 1200 + 900 is 3100 (ignores NULL values).

---

πŸ“Œ `AVG()` – Finding the Average

πŸ”Ή Why Do We Need `AVG()`?
AVG() calculates the average (mean) value of a numeric column.
πŸ“– Syntax:
SELECT AVG(column_name) FROM table_name;


---

Example 4: Find the Average Fees Paid
SELECT AVG(Fees_Paid) FROM Students;


πŸ”Ή Output:
| AVG(Fees_Paid) |
|---------------|
| 1033.33 |

βœ… Explanation:
- The average is (1000 + 1200 + 900) Γ· 3 = 1033.33 (ignores NULL values).

---

πŸ“Œ `MIN()` – Finding the Minimum Value

πŸ”Ή Why Do We Need `MIN()`?
MIN() returns the smallest value in a column.

πŸ“– Syntax:
SELECT MIN(column_name) FROM table_name;


---

Example 5: Find the Youngest Student’s Age
SELECT MIN(Age) FROM Students;


πŸ”Ή Output:
| MIN(Age) |
|---------|
| 18 |

βœ… Explanation:
- The minimum age in the table is 18.

---

πŸ“Œ `MAX()` – Finding the Maximum Value

πŸ”Ή Why Do We Need `MAX()`?
MAX() returns the largest value in a column.

πŸ“– Syntax:
SELECT MAX(column_name) FROM table_name;


---

Example 6: Find the Oldest Student’s Age
SELECT MAX(Age) FROM Students;


πŸ”Ή Output:
| MAX(Age) |
|---------|
| 20 |

βœ… Explanation:
- The maximum age in the table is 20.

---

πŸ“Œ Combining Aggregate Functions

We can use multiple aggregate functions in a single query.

Example 7: Get All Summary Data
SELECT 
COUNT(*) AS Total_Students,
SUM(Fees_Paid) AS Total_Fees,
AVG(Fees_Paid) AS Average_Fees,
MIN(Age) AS Youngest_Age,
MAX(Age) AS Oldest_Age
FROM Students;


πŸ”Ή Output:
| Total_Students | Total_Fees | Average_Fees | Youngest_Age | Oldest_Age |
|---------------|-----------|-------------|-------------|-----------|
| 4 | 3100 | 1033.33 | 18 | 20 |

βœ… Explanation:
- This query provides a complete summary of the student data.

---
❀1
🎯 Task for Today
βœ… Count the number of students in Grade A.
βœ… Find the total fees paid by students in Grade B.
βœ… Get the average age of students.
βœ… Find the highest and lowest fees paid.

---

πŸ” Summary
βœ… COUNT() β†’ Counts the number of rows.
βœ… SUM() β†’ Adds up values.
βœ… AVG() β†’ Finds the average.
βœ… MIN() β†’ Finds the smallest value.
βœ… MAX() β†’ Finds the largest value.

Tomorrow, we will learn about SQL GROUP BY & HAVING. πŸš€

Share with Credit: https://t.me/codingdidi
πŸ’‘ Like & Comment if you're ready for Day 6! 😊❀️
πŸ‘4
Day 6: SQL `GROUP BY` and `HAVING` – Grouping and Filtering Data

Welcome to Day 6 of learning SQL! πŸŽ‰

Yesterday, we learned about aggregate functions (COUNT, SUM, AVG, MIN, MAX) to summarize data. But what if we want to apply these functions to different groups of data? πŸ€”

For example, instead of finding the total fees paid by all students, what if we want to find the total fees paid per grade? That’s where GROUP BY comes in! πŸš€

---

πŸ”Ή Why Do We Need `GROUP BY`?
GROUP BY helps us group rows with the same values in a column and then apply aggregate functions to each group separately.

πŸ“– Syntax:
SELECT column_name, aggregate_function(column_name)
FROM table_name
GROUP BY column_name;

- column_name β†’ The column used for grouping.
- aggregate_function(column_name) β†’ Applies an aggregate function (e.g., SUM, AVG, COUNT, etc.) to each group.

---

πŸ“Œ `GROUP BY` Example – Total Fees Paid Per Grade
We will use the same Students table:

| Student_ID | Name | Age | Grade | Fees_Paid |
|------------|---------------|-----|-------|----------|
| 1 | John Doe | 18 | A | 1000 |
| 2 | Emma Smith | 19 | B | 1200 |
| 3 | Alex Brown | 20 | A | 900 |
| 4 | Sophia Johnson | 18 | C | NULL |
| 5 | Liam Davis | 19 | B | 1100 |

---

πŸ”Έ Find the Total Fees Paid Per Grade
SELECT Grade, SUM(Fees_Paid) AS Total_Fees
FROM Students
GROUP BY Grade;


πŸ”Ή Output:
| Grade | Total_Fees |
|-------|-----------|
| A | 1900 |
| B | 2300 |
| C | NULL |

βœ… Explanation:
- The query groups students by Grade.
- Then it calculates the total fees paid for each grade using SUM(Fees_Paid).
- Grade C shows NULL because Sophia hasn't paid fees (NULL values are ignored in SUM()).

---

πŸ”Έ Count the Number of Students in Each Grade
SELECT Grade, COUNT(*) AS Total_Students
FROM Students
GROUP BY Grade;


πŸ”Ή Output:
| Grade | Total_Students |
|-------|---------------|
| A | 2 |
| B | 2 |
| C | 1 |

βœ… Explanation:
- COUNT(*) counts all students in each grade.
- GROUP BY Grade groups them by grade before counting.

---

πŸ“Œ `HAVING` Clause – Filtering Groups

The WHERE clause cannot be used with aggregate functions because it filters individual rows before grouping.

🚨 Use `HAVING` to filter groups after aggregation!

πŸ“– Syntax:
SELECT column_name, aggregate_function(column_name)
FROM table_name
GROUP BY column_name
HAVING condition;


---

πŸ”Έ Find Grades Where Total Fees Paid is More Than 2000
SELECT Grade, SUM(Fees_Paid) AS Total_Fees
FROM Students
GROUP BY Grade
HAVING SUM(Fees_Paid) > 2000;


πŸ”Ή Output:
| Grade | Total_Fees |
|-------|-----------|
| B | 2300 |

βœ… Explanation:
- The query groups students by Grade and calculates total fees per grade.
- HAVING SUM(Fees_Paid) > 2000 filters only groups where the total fees paid exceeds 2000.
- Grade A (1900) is excluded, but Grade B (2300) is included.

---

πŸ”Έ Find Grades with More Than 1 Student
SELECT Grade, COUNT(*) AS Total_Students
FROM Students
GROUP BY Grade
HAVING COUNT(*) > 1;


πŸ”Ή Output:
| Grade | Total_Students |
|-------|---------------|
| A | 2 |
| B | 2 |

βœ… Explanation:
- COUNT(*) counts the number of students per grade.
- HAVING COUNT(*) > 1 filters out grades that have only 1 student (Grade C).

---

πŸ“Œ `WHERE` vs. `HAVING` – Key Differences

| Feature | WHERE | HAVING |
|----------|--------|---------|
| Filters individual rows before grouping | βœ… Yes | ❌ No |
| Filters groups after aggregation | ❌ No | βœ… Yes |
| Works with aggregate functions (SUM, COUNT, etc.) | ❌ No | βœ… Yes |

---

🎯 Task for Today
βœ… Find the total fees paid per grade but only show grades where fees are above 2000.
βœ… Count the number of students per age and show only ages where students are more than 1.
βœ… Find the average fees per grade and show only grades where the average fee is above 1000.

---
❀4πŸ‘3
πŸ” Summary
βœ… GROUP BY β†’ Groups rows by a column.
βœ… Aggregate functions (SUM, AVG, COUNT, etc.) summarize each group.
βœ… HAVING filters groups after aggregation.
βœ… WHERE filters before grouping.

Tomorrow, we will learn about SQL Joins (INNER JOIN, LEFT JOIN, etc.) to combine data from multiple tables! πŸš€

πŸ’‘ Like & Comment if you're ready for Day 7! 😊❀️
Day 7: SQL Hands-On Practice – Strengthening Your Basics 🎯

Congratulations! πŸŽ‰ You've completed the first 6 days of SQL learning! Now, before moving forward to more complex topics, it's important to review, practice, and solidify what we've learned so far.

Today, we will:
βœ”οΈ Revise the key SQL concepts covered this week.
βœ”οΈ Practice with real SQL queries.
βœ”οΈ Solve challenges on SQL platforms like HackerRank, LeetCode, and W3Schools.

---
πŸ“Œ Quick Revision of Week 1 Topics
Let’s quickly go over what we learned in the past 6 days.

πŸ”Ή Day 1: Introduction to SQL & Databases
- SQL (Structured Query Language) is used to store, retrieve, and manage data in databases.
- Popular database systems: MySQL, PostgreSQL, SQL Server.
- SQL operates on tables that store data in rows and columns.

πŸ”Ή Day 2: SQL Data Types & Basic Queries
- SQL supports different data types:
- INT (integer numbers)
- VARCHAR(n) (text)
- DATE (dates)
- DECIMAL(p,s) (for precise numbers like currency).
- Basic queries:
  SELECT column1, column2 FROM table_name;

- SELECT retrieves specific columns.
- FROM specifies the table.

πŸ”Ή Day 3: Filtering Data with `WHERE`
- The WHERE clause filters rows based on conditions.
- Comparison operators: =, >, <, >=, <=, !=
- Logical operators: AND, OR, NOT

SELECT * FROM Students WHERE Age > 18;

Filters students where `Age` is greater than 18.

πŸ”Ή Day 4: Sorting & Limiting Data
- ORDER BY sorts data in ascending (`ASC`) or descending (`DESC`) order.
- LIMIT restricts the number of rows.
- DISTINCT removes duplicates.

SELECT Name, Grade FROM Students ORDER BY Grade DESC LIMIT 3;

πŸ”Ή Finds the top 3 students with the highest grades.

πŸ”Ή Day 5: Aggregate Functions
- COUNT(), SUM(), AVG(), MIN(), MAX() summarize data.

SELECT COUNT(*) FROM Students WHERE Grade = 'A';

πŸ”Ή Counts how many students got Grade A.

πŸ”Ή Day 6: Grouping Data with `GROUP BY` & `HAVING`
- GROUP BY groups rows based on a column.
- HAVING filters groups (used instead of WHERE for aggregated data).

SELECT Grade, AVG(Fees_Paid) FROM Students GROUP BY Grade HAVING AVG(Fees_Paid) > 1000;

πŸ”Ή Finds grades where the average fees paid is greater than 1000.

---

🎯 Hands-On Practice: Solve These SQL Problems

Problem 1: Find the Total Fees Paid by Each Grade
SELECT Grade, SUM(Fees_Paid) AS Total_Fees
FROM Students
GROUP BY Grade;

πŸ”Ή Expected Output:
| Grade | Total_Fees |
|-------|-----------|
| A | 1900 |
| B | 2300 |
| C | NULL |

Task: Run this query and check if your database returns the correct results.

---

Problem 2: List Students Who Are 18 Years or Older
SELECT Name, Age FROM Students WHERE Age >= 18;

Expected Output: All students aged 18 or older.

---

Problem 3: Count How Many Students Are in Each Grade
SELECT Grade, COUNT(*) AS Student_Count
FROM Students
GROUP BY Grade;

Expected Output:
| Grade | Student_Count |
|-------|--------------|
| A | 2 |
| B | 2 |
| C | 1 |

---

Problem 4: Get the Top 2 Youngest Students
SELECT Name, Age FROM Students ORDER BY Age ASC LIMIT 2;

Expected Output: The 2 youngest students.

---

Problem 5: Find the Maximum Fees Paid by Any Student
SELECT MAX(Fees_Paid) AS Max_Fees FROM Students;

πŸ”Ή Expected Output: The highest fee paid.

---

🌍 Platforms to Practice SQL
If you don’t have SQL installed, you can practice online for free on these platforms:

| Platform | Features |
|--------------|-------------|
| [HackerRank](https://www.hackerrank.com/domains/sql) | Beginner to advanced SQL challenges |
| [LeetCode SQL](https://leetcode.com/problemset/database/) | Real-world SQL interview questions |
| [W3Schools SQL](https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all) | Interactive SQL editor |

---

πŸ“Œ Your Tasks for Today
βœ… Revise all SQL topics from Day 1 – Day 6.
βœ… Write and run the 5 practice queries above.
βœ… Solve at least 3 SQL challenges on HackerRank, LeetCode, or W3Schools.
βœ… Comment "Done βœ…" if you've completed today's tasks!
πŸ‘3
Tomorrow, we move on to SQL Joins (INNER JOIN, LEFT JOIN, etc.) – a crucial topic for combining multiple tables! πŸš€

Like ❀️ and Share if you're excited for Day 8! 😊
❀1
Day 8: SQL JOINS – Combining Data from Multiple Tables πŸ”—

Welcome to Week 2 of your SQL journey! πŸš€

So far, we have learned how to retrieve, filter, sort, and aggregate data from a single table. But in real-world databases, data is stored across multiple tables to maintain efficiency and reduce redundancy.

πŸ’‘ How do we fetch related data from multiple tables?
πŸ‘‰ Using SQL JOINS!

Today, we will cover:
βœ”οΈ What are JOINS?
βœ”οΈ Types of JOINS (Focusing on INNER JOIN & LEFT JOIN today).
βœ”οΈ Real-life examples with simple explanations.
βœ”οΈ Hands-on SQL queries.

---

πŸ“Œ What are SQL JOINS?
A JOIN is used to combine rows from two or more tables based on a related column.

Imagine you have:
- Students Table (Stores student details).
- Courses Table (Stores course details).

If you want to find which student is enrolled in which course, you need to JOIN these two tables on a common column (e.g., Student_ID).

---

πŸ”Ή Types of SQL JOINS
1️⃣ INNER JOIN – Returns only matching records from both tables.
2️⃣ LEFT JOIN – Returns all records from the left table and matching records from the right table.
3️⃣ RIGHT JOIN – Returns all records from the right table and matching records from the left table.
4️⃣ FULL JOIN – Returns all records from both tables (matching and non-matching).

---

πŸ”Ή Understanding INNER JOIN (Most Common JOIN)
INNER JOIN returns only the matching records from both tables.

🎯 Example: Students and Courses
| Students Table | | Courses Table |
|------------------|-----------------|------------------|
| Student_ID | Name | Course_ID | Course_ID | Course_Name |
|-----------|--------|----------|----------|-------------|
| 1 | Alice | C101 | C101 | Python |
| 2 | Bob | C102 | C102 | SQL |
| 3 | Charlie| C103 | C103 | Power BI |
| 4 | David | NULL | | |

πŸ”Ή David has no course assigned (NULL value in Course_ID).
πŸ”Ή To get only students who are enrolled in a course, we use INNER JOIN.

SELECT Students.Name, Courses.Course_Name
FROM Students
INNER JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


πŸ”Ή Output:
| Name | Course_Name |
|-------|------------|
| Alice | Python |
| Bob | SQL |
| Charlie | Power BI |

πŸš€ David is not included because he has no matching Course_ID.

---
πŸ”Ή Understanding LEFT JOIN
πŸ”Ή LEFT JOIN returns ALL records from the left table (Students) and matching records from the right table (Courses).
πŸ”Ή If there is no match, NULL is returned.

SELECT Students.Name, Courses.Course_Name
FROM Students
LEFT JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


πŸ”Ή Output (Now including David too):
| Name | Course_Name |
|-------|------------|
| Alice | Python |
| Bob | SQL |
| Charlie | Power BI |
| David | NULL |

πŸš€ David is included, but Course_Name is NULL because there is no matching Course_ID.

---
🎯 Hands-On Practice: Solve These SQL Problems
1️⃣ Find all students who are enrolled in a course (Use INNER JOIN).
SELECT Students.Name, Courses.Course_Name
FROM Students
INNER JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


2️⃣ Find all students, even those without courses (Use LEFT JOIN).
SELECT Students.Name, Courses.Course_Name
FROM Students
LEFT JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


3️⃣ Find courses that have students enrolled (Use INNER JOIN with Course as the left table).
SELECT Courses.Course_Name, Students.Name
FROM Courses
INNER JOIN Students
ON Students.Course_ID = Courses.Course_ID;

πŸ“Œ Your Tasks for Today
βœ… Revise INNER JOIN & LEFT JOIN.
βœ… Run the practice queries in SQL.
βœ… Try at least 3 SQL JOIN problems on HackerRank or LeetCode.
βœ… Comment "Done βœ…" once you complete today's practice!

Tomorrow, we’ll explore RIGHT JOIN, FULL JOIN, and SELF JOIN!

πŸ‘‰ Like ❀️ and Share if you’re excited for Day 9! 😊
❀4πŸ‘2
Day 9: SQL JOINS Continued – RIGHT JOIN, FULL OUTER JOIN, and SELF JOIN πŸ”—

Welcome back! Yesterday, we learned about INNER JOIN and LEFT JOIN, which help us combine data from multiple tables. Today, we’ll continue exploring more SQL JOINS, including:

βœ”οΈ RIGHT JOIN – Opposite of LEFT JOIN
βœ”οΈ FULL OUTER JOIN – Returns all records from both tables
βœ”οΈ SELF JOIN – Joining a table with itself

By the end of today’s lesson, you’ll have a strong understanding of how to combine data across tables efficiently.

---

πŸ“Œ Recap of JOINS
πŸ”Ή INNER JOIN β†’ Returns only matching records from both tables.
πŸ”Ή LEFT JOIN β†’ Returns all records from the left table, with matching records from the right table.

Now, let’s move on to RIGHT JOIN, FULL OUTER JOIN, and SELF JOIN.

---

πŸ”Ή RIGHT JOIN – The Opposite of LEFT JOIN
πŸ”Ή RIGHT JOIN (or RIGHT OUTER JOIN) returns:
βœ… All records from the right table
βœ… Matching records from the left table
βœ… If there’s no match, the left table will show NULL values

🎯 Example: Students and Courses
| Students Table | | Courses Table |
|------------------|-----------------|------------------|
| Student_ID | Name | Course_ID | Course_ID | Course_Name |
|-----------|--------|----------|----------|-------------|
| 1 | Alice | C101 | C101 | Python |
| 2 | Bob | C102 | C102 | SQL |
| 3 | Charlie| C103 | C103 | Power BI |
| 4 | David | NULL | C104 | JavaScript |

πŸ”Ή C104 (JavaScript) has no students enrolled.

πŸ‘‰ RIGHT JOIN Query:
SELECT Students.Name, Courses.Course_Name
FROM Students
RIGHT JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


πŸ”Ή Output
| Name | Course_Name |
|-------|------------|
| Alice | Python |
| Bob | SQL |
| Charlie | Power BI |
| NULL | JavaScript |

πŸš€ JavaScript is included, but no student is enrolled (NULL in Name column).

πŸ“Œ Key Takeaway:
Use RIGHT JOIN when you want all data from the right table and matching data from the left.

---

πŸ”Ή FULL OUTER JOIN – All Data from Both Tables
πŸ”Ή FULL OUTER JOIN returns:
βœ… All records from both tables
βœ… If there’s no match, NULL values will be filled

πŸ‘‰ FULL OUTER JOIN Query:
SELECT Students.Name, Courses.Course_Name
FROM Students
FULL OUTER JOIN Courses
ON Students.Course_ID = Courses.Course_ID;

πŸ”Ή Output
| Name | Course_Name |
|-------|------------|
| Alice | Python |
| Bob | SQL |
| Charlie | Power BI |
| David | NULL |
| NULL | JavaScript |

πŸš€ David (who has no course) and JavaScript (which has no students) are both included.

πŸ“Œ Key Takeaway:
Use FULL OUTER JOIN when you need all data from both tables, even if there’s no match.

❗️ Note: Not all databases support FULL OUTER JOIN. If yours doesn’t, you can simulate it using `UNION`:
SELECT Students.Name, Courses.Course_Name
FROM Students
LEFT JOIN Courses ON Students.Course_ID = Courses.Course_ID
UNION
SELECT Students.Name, Courses.Course_Name
FROM Students
RIGHT JOIN Courses ON Students.Course_ID = Courses.Course_ID;


---

πŸ”Ή SELF JOIN – When a Table Joins Itself
πŸ”Ή Sometimes, a table contains hierarchical or related data within itself.
πŸ”Ή A SELF JOIN allows a table to join with itself to compare data in different rows.

🎯 Example: Employee Hierarchy
| Employee_ID | Name | Manager_ID |
|------------|--------|------------|
| 1 | Alice | NULL |
| 2 | Bob | 1 |
| 3 | Charlie| 1 |
| 4 | David | 2 |

πŸ”Ή Here, Bob and Charlie report to Alice, and David reports to Bob.

πŸ‘‰ SELF JOIN Query to Find Employee-Manager Relationship:
SELECT E1.Name AS Employee, E2.Name AS Manager
FROM Employees E1
LEFT JOIN Employees E2
ON E1.Manager_ID = E2.Employee_ID;


πŸ”Ή Output
| Employee | Manager |
|----------|---------|
| Alice | NULL |
| Bob | Alice |
| Charlie | Alice |
| David | Bob |

πŸš€ Alice has no manager (NULL), Bob & Charlie report to Alice, and David reports to Bob.
πŸ‘2
πŸ“Œ Key Takeaway:
Use SELF JOIN when working with hierarchical data like employees and managers, product categories, etc.

---

🎯 Hands-On Practice: Try These Queries
1️⃣ Get all students and their courses using RIGHT JOIN.
SELECT Students.Name, Courses.Course_Name
FROM Students
RIGHT JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


2️⃣ List all students and all courses, even if there is no match (FULL OUTER JOIN).
SELECT Students.Name, Courses.Course_Name
FROM Students
FULL OUTER JOIN Courses
ON Students.Course_ID = Courses.Course_ID;


3️⃣ Find employee-manager relationships using SELF JOIN.
SELECT E1.Name AS Employee, E2.Name AS Manager
FROM Employees E1
LEFT JOIN Employees E2
ON E1.Manager_ID = E2.Employee_ID;


---



πŸ“Œ Your Tasks for Today
βœ… Revise RIGHT JOIN, FULL OUTER JOIN, and SELF JOIN.
βœ… Run the practice queries in SQL.
βœ… Try at least 3 SQL JOIN problems on HackerRank or LeetCode.
βœ… Comment "Done βœ…" once you complete today's practice!

Tomorrow, we’ll explore NULL values and how to handle them in SQL!

πŸ‘‰ Like ❀️ and Share if you’re excited for Day 10! 😊
❀2
Day 10: Working with NULL Values & Using CASE Statements in SQL

Welcome back! Today, we’re going to cover two important SQL topics:

βœ”οΈ NULL values – What they are and how to handle them.
βœ”οΈ CASE statements – A powerful way to apply conditional logic in SQL.

By the end of today’s lesson, you’ll understand how to deal with missing data (NULL) and how to write conditional logic directly in SQL queries.

---

πŸ“Œ What is NULL in SQL?
πŸ”Ή In SQL, NULL means "missing" or "unknown" data.
πŸ”Ή It is not the same as 0 or an empty string ("").
πŸ”Ή When a column has NULL, it means no value has been assigned yet.

🎯 Example: Employee Salaries
| Employee_ID | Name | Salary |
|------------|--------|--------|
| 1 | Alice | 50000 |
| 2 | Bob | NULL |
| 3 | Charlie| 60000 |
| 4 | David | NULL |

Bob and David have NULL salaries, meaning we don’t know their salary yet.

---

πŸ”Ή How to Handle NULL Values in SQL
1️⃣ Checking for NULL using `IS NULL` and `IS NOT NULL`
πŸš€ Find employees whose salary is missing:
SELECT Name 
FROM Employees
WHERE Salary IS NULL;

πŸ”Ή Output:
| Name |
|-------|
| Bob |
| David |

πŸš€ Find employees whose salary is known:
SELECT Name, Salary 
FROM Employees
WHERE Salary IS NOT NULL;

πŸ”Ή Output:
| Name | Salary |
|--------|--------|
| Alice | 50000 |
| Charlie| 60000 |

πŸ“Œ Important: You cannot check NULL with = NULL or != NULL. Always use IS NULL or IS NOT NULL.

---

2️⃣ Replacing NULL Values Using `COALESCE()`
πŸ”Ή COALESCE() replaces `NULL` with a default value.

πŸš€ Example: Replace NULL salaries with "Not Assigned"
SELECT Name, COALESCE(Salary, 'Not Assigned') AS Salary 
FROM Employees;

πŸ”Ή Output:
| Name | Salary |
|---------|-------------|
| Alice | 50000 |
| Bob | Not Assigned |
| Charlie | 60000 |
| David | Not Assigned |

πŸ’‘ `COALESCE()` takes multiple values and returns the first non-NULL value.

---

3️⃣ Handling NULL in Aggregations
πŸ”Ή Aggregate functions (SUM, AVG, COUNT, etc.) automatically ignore NULLs.

πŸš€ Find total salary of all employees:
SELECT SUM(Salary) AS Total_Salary 
FROM Employees;

πŸ”Ή Output:
| Total_Salary |
|-------------|
| 110000 |

πŸ“Œ NULL salaries are ignored in SUM.

πŸš€ Find average salary (excluding NULL values):
SELECT AVG(Salary) AS Avg_Salary 
FROM Employees;

πŸ”Ή Output:
| Avg_Salary |
|-----------|
| 55000 |

πŸ”Ή If you want to include NULL as 0 in calculations, use COALESCE(Salary, 0):
SELECT AVG(COALESCE(Salary, 0)) AS Avg_Salary 
FROM Employees;

πŸ”Ή Output:
| Avg_Salary |
|-----------|
| 36666.67 |

Now, let's move on to CASE statements.

---

πŸ”Ή Using CASE Statements in SQL
πŸ”Ή CASE is like an IF-ELSE statement in SQL.
πŸ”Ή It allows you to return different values based on conditions.

🎯 Example: Categorizing Employees by Salary
SELECT Name, Salary,
CASE
WHEN Salary >= 60000 THEN 'High Salary'
WHEN Salary >= 40000 THEN 'Medium Salary'
ELSE 'Low Salary'
END AS Salary_Category
FROM Employees;


πŸ”Ή Output:
| Name | Salary | Salary_Category |
|---------|--------|----------------|
| Alice | 50000 | Medium Salary |
| Bob | NULL | Low Salary |
| Charlie | 60000 | High Salary |
| David | NULL | Low Salary |

πŸ“Œ NULL values are treated as `ELSE` conditions unless handled separately.

πŸš€ Handling NULL separately in CASE:
SELECT Name, 
CASE
WHEN Salary IS NULL THEN 'Salary Not Available'
WHEN Salary >= 60000 THEN 'High Salary'
WHEN Salary >= 40000 THEN 'Medium Salary'
ELSE 'Low Salary'
END AS Salary_Category
FROM Employees;

πŸ”Ή Now, NULL values are labeled as "Salary Not Available".

---

🎯 Hands-On Practice: Try These Queries
1️⃣ Find all employees whose salary is NULL.
SELECT Name FROM Employees WHERE Salary IS NULL;


2️⃣ Replace NULL salaries with 0.
SELECT Name, COALESCE(Salary, 0) AS Salary FROM Employees;
πŸ‘4
3️⃣ Find employees categorized by salary range.
SELECT Name, 
CASE
WHEN Salary >= 70000 THEN 'High Salary'
WHEN Salary >= 50000 THEN 'Medium Salary'
ELSE 'Low Salary'
END AS Salary_Category
FROM Employees;



πŸ“Œ Your Tasks for Today
βœ… Practice `IS NULL`, `COALESCE()`, and `CASE` statements.
βœ… Run the example queries in SQL.
βœ… Solve at least 2 SQL problems from LeetCode.
βœ… Comment "Done βœ…" once you complete today’s practice!

Tomorrow, we’ll dive into subqueries and correlated subqueries!

πŸ‘‰ Like ❀️ and Share if you're excited for Day 11! 😊
❀4
As I was having Uni exam, therefore, will continue this series from tomorrow.

Happy Learning!!
πŸ‘7
Let's continue our learning!!

Day 11: Understanding Subqueries and Correlated Subqueries in SQL

Welcome back! Today, we are going to explore an advanced yet essential SQL concept: Subqueries and Correlated Subqueries.

By the end of today’s session, you will understand:
βœ”οΈ What subqueries are and how they work.
βœ”οΈ The difference between subqueries and correlated subqueries.
βœ”οΈ When and how to use them in SQL queries.

---

πŸ“Œ What is a Subquery in SQL?
A subquery is a query inside another query.
- It is also called a nested query.
- It helps fetch data from multiple tables in a structured way.
- The result of the subquery is used in the main query.

πŸ›  Basic Syntax of a Subquery
SELECT column1, column2 
FROM main_table
WHERE column_name OPERATOR (
SELECT column_name FROM sub_table WHERE condition
);

- The inner query (subquery) runs first.
- The outer query then uses the subquery’s result.

---

πŸ”Ή Example 1: Find Employees Who Earn More Than the Average Salary
🎯 Problem Statement:
We want to find employees whose salaries are higher than the average salary of all employees.

πŸš€ SQL Query:
SELECT Name, Salary 
FROM Employees
WHERE Salary > (SELECT AVG(Salary) FROM Employees);

πŸ” How it Works?
1. Subquery: SELECT AVG(Salary) FROM Employees;
- Finds the average salary from the Employees table.
2. Main Query:
- Selects employees whose salaries are greater than this average.

βœ… Example Output:
| Name | Salary |
|---------|--------|
| Charlie | 60000 |

---

πŸ”Ή Example 2: Find Customers Who Placed Orders
🎯 Problem Statement:
We want to find customers who have placed at least one order.

πŸš€ SQL Query:
SELECT CustomerID, CustomerName 
FROM Customers
WHERE CustomerID IN (SELECT DISTINCT CustomerID FROM Orders);

πŸ” How it Works?
1. Subquery: SELECT DISTINCT CustomerID FROM Orders;
- Finds unique customers who placed orders.
2. Main Query:
- Selects those customers from the Customers table.

βœ… Example Output:
| CustomerID | CustomerName |
|-----------|--------------|
| 101 | Alice |
| 102 | Bob |

---

πŸ“Œ Types of Subqueries in SQL
There are three types of subqueries:
1️⃣ Single-Row Subquery: Returns one value.
2️⃣ Multi-Row Subquery: Returns multiple values.
3️⃣ Multi-Column Subquery: Returns multiple columns.

πŸ”Ή Single-Row Subquery Example
Find employees whose salaries are equal to the highest salary.
SELECT Name, Salary 
FROM Employees
WHERE Salary = (SELECT MAX(Salary) FROM Employees);

βœ… Returns one row because MAX(Salary) is a single value.

---

πŸ”Ή Multi-Row Subquery Example
Find all employees who work in departments located in New York.
SELECT Name, DepartmentID 
FROM Employees
WHERE DepartmentID IN (SELECT DepartmentID FROM Departments WHERE Location = 'New York');

βœ… The subquery returns multiple DepartmentIDs, so we use IN.

---

πŸ”Ή Multi-Column Subquery Example
Find employees whose department and location match the highest-paid employee.
SELECT Name, DepartmentID, Location 
FROM Employees
WHERE (DepartmentID, Location) =
(SELECT DepartmentID, Location FROM Employees ORDER BY Salary DESC LIMIT 1);

βœ… The subquery returns two columns, so we use a tuple (DepartmentID, Location).

---

πŸ“Œ What is a Correlated Subquery?
A correlated subquery is different from a regular subquery:
βœ… The subquery depends on the outer query.
βœ… The subquery runs once for each row in the main query.
βœ… It is usually used with EXISTS, NOT EXISTS, or WHERE clauses.

---

πŸ”Ή Example 3: Correlated Subquery
🎯 Problem Statement:
Find employees who earn more than the average salary of their own department.

πŸš€ SQL Query:
SELECT e1.Name, e1.DepartmentID, e1.Salary 
FROM Employees e1
WHERE Salary > (
SELECT AVG(e2.Salary)
FROM Employees e2
WHERE e1.DepartmentID = e2.DepartmentID
);

πŸ” How it Works?
1. The subquery depends on the outer query.
2. It calculates the average salary per department.
3. The main query checks if each employee's salary is higher than their department’s average.
πŸ‘4❀1
βœ… Example Output:
| Name | DepartmentID | Salary |
|---------|-------------|--------|
| Alice | 101 | 50000 |
| Charlie | 102 | 60000 |

---

πŸ“Œ Difference Between Subquery and Correlated Subquery
| Feature | Subquery | Correlated Subquery |
|---------|----------|--------------------|
| Runs | Runs once | Runs once per row in main query |
| Dependent on Outer Query? | No | Yes |
| Performance | Faster | Slower |
| Example Usage | Find employees with salary above average | Find employees earning above their department’s average |

---

🎯 Hands-On Practice: Try These Queries
1️⃣ Find all employees who have the same salary as Bob.
SELECT Name FROM Employees WHERE Salary = 
(SELECT Salary FROM Employees WHERE Name = 'Bob');


2️⃣ Find all orders placed in 2024 by customers who live in New York.
SELECT OrderID FROM Orders 
WHERE CustomerID IN (SELECT CustomerID FROM Customers WHERE City = 'New York')
AND OrderDate BETWEEN '2024-01-01' AND '2024-12-31';


3️⃣ Find employees whose salary is higher than the average salary in their department.
SELECT Name, Salary FROM Employees e1 
WHERE Salary > (SELECT AVG(Salary) FROM Employees e2 WHERE e1.DepartmentID = e2.DepartmentID);


---

πŸ“Œ Your Tasks for Today
βœ… Practice at least 3 subquery-based problems.
βœ… Try writing a correlated subquery.
βœ… Comment "Done βœ…" once you complete today’s practice!

Tomorrow, we will explore JOINS and their types in SQL!

πŸ‘‰ Like ❀️ and Share if you're excited for Day 12! 😊
❀3