SQL For Data Analytics
This channel covers everything you need to learn SQL for data science, data analyst, data engineer and business analyst roles.
Ko'proq ko'rsatish📈 Telegram kanali SQL For Data Analytics analitikasi
SQL For Data Analytics (@mysqldata) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 10 259 obunachidan iborat bo'lib, Taʼlim toifasida 19 281-o'rinni va Hindiston mintaqasida 38 713-o'rinni egallagan.
📊 Auditoriya ko‘rsatkichlari va dinamika
невідомо sanasidan buyon loyiha tez o‘sib, 10 259 obunachiga ega bo‘ldi.
08 Iyul, 2026 dagi oxirgi ma’lumotlarga ko‘ra kanal barqaror faollikka ega. Oxirgi 30 kunda obunachilar soni 1 399 ga, so‘nggi 24 soatda esa 22 ga o‘zgardi va umumiy qamrov yuqori darajada qolmoqda.
- Tasdiqlash holati: Tasdiqlanmagan
- Jalb etish (ER): Auditoriya o‘rtacha 24.63% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining 11.77% ini tashkil etuvchi reaksiyalarni to‘playdi.
- Post qamrovi: Har bir post o‘rtacha 2 525 marta ko‘riladi; birinchi sutkada odatda 1 207 ta ko‘rish yig‘iladi.
- Reaksiyalar va o‘zaro ta’sir: Auditoriya faol: har bir postga o‘rtacha 14 ta reaksiya keladi.
- Tematik yo‘nalishlar: Kontent sql, analyst, database, engineering, greeting kabi asosiy mavzularga jamlangan.
📝 Tavsif va kontent siyosati
Muallif resursni shaxsiy fikrni ifoda etish maydoni sifatida ta’riflaydi:
“This channel covers everything you need to learn SQL for data science, data analyst, data engineer and business analyst roles.”
Yuqori yangilanish chastotasi (oxirgi ma’lumot 09 Iyul, 2026 da olingan) sababli kanal doimo dolzarb va katta qamrovli bo‘lib qoladi. Analitika auditoriya kontent bilan faol hamkorlik qilishini, uni Taʼlim toifasidagi muhim ta’sir nuqtasiga aylantirishini ko‘rsatadi.
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!