SQL For Data Analytics
This channel covers everything you need to learn SQL for data science, data analyst, data engineer and business analyst roles.
Show more📈 Analytical overview of Telegram channel SQL For Data Analytics
Channel SQL For Data Analytics (@mysqldata) in the English language segment is an active participant. Currently, the community unites 10 259 subscribers, ranking 19 281 in the Education category and 38 713 in the India region.
📊 Audience metrics and dynamics
Since its creation on невідомо, the project has demonstrated rapid growth, gathering an audience of 10 259 subscribers.
According to the latest data from 08 July, 2026, the channel demonstrates stable activity. Although there has been a change in the number of participants by 1 399 over the last 30 days and by 22 over the last 24 hours, overall reach remains high.
- Verification status: Not verified
- Engagement rate (ER): The average audience engagement rate is 24.63%. Within the first 24 hours after publication, content typically collects 11.77% reactions from the total number of subscribers.
- Post reach: On average, each post receives 2 525 views. Within the first day, a publication typically gains 1 207 views.
- Reactions and interaction: The audience actively supports content: the average number of reactions per post is 14.
- Thematic interests: Content is focused on key topics such as sql, analyst, database, engineering, greeting.
📝 Description and content policy
The author describes the resource as a platform for expressing subjective opinions:
“This channel covers everything you need to learn SQL for data science, data analyst, data engineer and business analyst roles.”
Thanks to the high frequency of updates (latest data received on 09 July, 2026), the channel maintains relevance and a high level of publication reach. Analytics show that the audience actively interacts with content, making it an important point of influence in the Education category.
COUNT(*) counts all rows, including those with NULLs.
- COUNT(column_name) counts only rows where the column is NOT NULL.
2️⃣ Q: When would you use GROUP BY with aggregate functions?
A:
Use GROUP BY when you want to apply aggregate functions per group (e.g., department-wise total salary):
SELECT department, SUM(salary) FROM employees GROUP BY department;
3️⃣ Q: What does the COALESCE() function do?
A:
COALESCE() returns the first non-null value from the list of arguments.
Example:
SELECT COALESCE(phone, 'N/A') FROM users;
4️⃣ Q: How does the CASE statement work in SQL?
A:
CASE is used for conditional logic inside queries.
Example:
SELECT name,
CASE
WHEN score >= 90 THEN 'A'
WHEN score >= 75 THEN 'B'
ELSE 'C'
END AS grade
FROM students;
5️⃣ Q: What’s the use of SUBSTRING() function?
A:
It extracts a part of a string.
Example:
SELECT SUBSTRING('DataScience', 1, 4); -- Output: Data
6️⃣ Q: What’s the output of LENGTH('SQL')?
A:
It returns the length of the string: 3
7️⃣ Q: How do you find the number of days between two dates?
A:
Use DATEDIFF(end_date, start_date)
Example:
SELECT DATEDIFF('2026-01-10', '2026-01-05'); -- Output: 5
8️⃣ Q: What does ROUND() do in SQL?
A:
It rounds a number to the specified decimal places.
Example:
SELECT ROUND(3.456, 2); -- Output: 3.46
💡 Pro Tip: Always mention real use cases when answering — it shows practical understanding.
💬 Tap ❤️ for more!SELECT column_name
FROM table_name;
How SQL executes:
1. Finds table (FROM)
2. Applies filter (WHERE)
3. Returns selected columns (SELECT)
4. Sorts results (ORDER BY)
5. Limits rows (LIMIT)
🔹 1. SELECT All Columns (SELECT *)
Used to retrieve every column from a table.
SELECT *
FROM employees;
👉 Returns complete table data.
📌 When to use:
✔ Exploring new dataset
✔ Checking table structure
✔ Quick testing
⚠️ Avoid in production: Slow on large tables, fetches unnecessary data.
🔹 2. SELECT Specific Columns
Best practice — retrieve only required data.
SELECT name, salary
FROM employees;
👉 Returns only selected columns.
💡 Why important:
✅ Faster queries
✅ Better performance
✅ Cleaner results
🔹 3. FROM Clause (Data Source)
Specifies where data comes from.
SELECT name
FROM customers;
👉 SQL reads data from customers table.
🔹 4. WHERE Clause (Filtering Data)
Used to filter rows based on conditions.
SELECT column
FROM table
WHERE condition;
Examples:
- Filter by value: SELECT * FROM employees WHERE salary > 50000;
- Filter by text: SELECT * FROM employees WHERE city = 'Mumbai';
🔹 5. ORDER BY (Sorting Results)
Sorts query results.
SELECT column
FROM table
ORDER BY column ASC | DESC;
Examples:
- Ascending: SELECT name, salary FROM employees ORDER BY salary ASC;
- Descending: SELECT name, salary FROM employees ORDER BY salary DESC;
🔹 6. LIMIT (Control Output Rows)
Restricts number of returned rows.
SELECT *
FROM employees
LIMIT 5;
👉 Returns first 5 records.
⭐ SQL Query Execution Order
1. FROM
2. WHERE
3. SELECT
4. ORDER BY
5. LIMIT
🧠 Real-World Example
Business question: "Show top 10 highest paid employees."
SELECT name, salary
FROM employees
ORDER BY salary DESC
LIMIT 10;
🚀 Mini Practice Tasks
✅ Task 1: Get all records from customers.
✅ Task 2: Show only customer name and city.
✅ Task 3: Find employees with salary > 40000.
✅ Task 4: Show top 3 highest priced products.
Double Tap ♥️ For Part-2GROUP BY does.
1️⃣ ROW_NUMBER()
Gives a unique number to each row in a partition.
SELECT name, dept_id,
ROW_NUMBER() OVER (
PARTITION BY dept_id
ORDER BY salary DESC
) AS rank
FROM employees;
📌 Use case: Rank employees by salary within each department.
2️⃣ RANK() vs DENSE_RANK()
⦁ RANK() → Skips numbers on ties (1, 2, 2, 4)
⦁ DENSE_RANK() → No gaps (1, 2, 2, 3)
SELECT name, salary,
RANK() OVER (ORDER BY salary DESC) AS rnk,
DENSE_RANK() OVER (ORDER BY salary DESC) AS dense_rnk
FROM employees;
3️⃣ LAG() and LEAD()
Access previous/next row values.
SELECT name, salary,
LAG(salary) OVER (ORDER BY id) AS prev_salary,
LEAD(salary) OVER (ORDER BY id) AS next_salary
FROM employees;
📌 Use case: Compare current row to previous/next (e.g., salary or stock change).
4️⃣ NTILE(n)
Divides rows into n buckets.
SELECT name,
NTILE(4) OVER (ORDER BY salary DESC) AS quartile
FROM employees;
📌 Use case: Quartiles/percentile-style grouping.
5️⃣ SUM(), AVG(), COUNT() with OVER()
Running totals, partition-wise aggregates, moving stats.
SELECT name, dept_id, salary,
SUM(salary) OVER (PARTITION BY dept_id) AS dept_total
FROM employees;
🧠 Interview Q&A
Q1: Difference between GROUP BY and OVER()?
⦁ GROUP BY → Collapses rows into groups; one row per group.
⦁ OVER() → Keeps all rows; adds an extra column with the aggregate.
Q2: When would you use LAG()?
To compare current row values with previous ones (e.g., day‑to‑day revenue change, previous month’s balance).
Q3: What happens if no PARTITION BY is used?
The function runs over the entire result set as a single partition.
Q4: Can you sort inside OVER()?
Yes, ORDER BY inside OVER() defines the calculation order (needed for ranking, LAG/LEAD, running totals).
💬 Double Tap ❤️ for more!