Data Analytics
Perfect channel to learn Data Analytics Learn SQL, Python, Alteryx, Tableau, Power BI and many more For Promotions: @coderfun @love_data
إظهار المزيد📈 نظرة تحليلية على قناة تيليجرام Data Analytics
تُعد قناة Data Analytics (@sqlspecialist) في القطاع اللغوي الإنكليزية لاعباً نشطاً. يضم المجتمع حالياً 109 659 مشتركاً، محتلاً المرتبة 1 122 في فئة التكنولوجيات والتطبيقات والمرتبة 2 340 في منطقة الهند.
📊 مؤشرات الجمهور والحراك
منذ تأسيسه في невідомо، حقق المشروع نمواً سريعاً وجمع 109 659 مشتركاً.
بحسب آخر البيانات بتاريخ 24 يونيو, 2026، تحافظ القناة على نشاط مستقر. خلال آخر 30 يوماً تغيّر عدد الأعضاء بمقدار 584، وفي آخر 24 ساعة بمقدار 71، مع بقاء الوصول العام مرتفعاً.
- حالة التحقق: غير موثّقة
- معدل التفاعل (ER): يبلغ متوسط تفاعل الجمهور 2.76%. وخلال أول 24 ساعة من النشر يحصد المحتوى عادةً 0.68% من ردود الفعل نسبةً إلى إجمالي المشتركين.
- وصول المنشورات: يحصل كل منشور على متوسط 3 024 مشاهدة. وخلال اليوم الأول يجمع عادةً 743 مشاهدة.
- التفاعلات والاستجابة: يتفاعل الجمهور بانتظام؛ متوسط التفاعلات لكل منشور يبلغ 8.
- الاهتمامات الموضوعية: يركز المحتوى على مواضيع رئيسية مثل row, sql, analytic, analyst, visualization.
📝 الوصف وسياسة المحتوى
يصف المؤلف القناة بأنها مساحة للتعبير عن الآراء الذاتية:
“Perfect channel to learn Data Analytics
Learn SQL, Python, Alteryx, Tableau, Power BI and many more
For Promotions: @coderfun @love_data”
بفضل وتيرة التحديث المرتفعة (أحدث البيانات بتاريخ 25 يونيو, 2026) تحافظ القناة على حداثتها ومستوى وصول مرتفع. وتُظهر التحليلات تفاعلاً نشطاً من الجمهور، ما يجعلها نقطة تأثير مهمة ضمن فئة التكنولوجيات والتطبيقات.
SELECT column1, column2, window_function() OVER (PARTITION BY column ORDER BY column) AS alias FROM table_name;
✔ PARTITION BY groups rows before applying the function
✔ ORDER BY determines the ranking or sequence
3️⃣ Using ROW_NUMBER()
🔹 Assign a unique row number to each employee based on salary (highest first)
SELECT name, department, salary, ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) AS row_num FROM employees;
✔ Each employee gets a unique row number within their department.
4️⃣ Using RANK() and DENSE_RANK()
🔹 Rank employees by salary within each department
SELECT name, department, salary, RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS rank, DENSE_RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS dense_rank FROM employees;
✔ RANK() skips numbers when there’s a tie
✔ DENSE_RANK() does not skip numbers
5️⃣ Using NTILE() for Distribution
🔹 Divide employees into 4 salary groups per department
SELECT name, department, salary, NTILE(4) OVER (PARTITION BY department ORDER BY salary DESC) AS salary_quartile FROM employees;
✔ Useful for dividing salaries into percentiles (e.g., top 25%, bottom 25%)
6️⃣ Running Total with SUM() OVER()
🔹 Calculate cumulative salary per department
SELECT name, department, salary, SUM(salary) OVER (PARTITION BY department ORDER BY salary DESC) AS running_total FROM employees;
✔ Useful for tracking cumulative totals
7️⃣ Using LAG() and LEAD()
🔹 Compare an employee’s salary with the previous and next employee’s salary
SELECT name, department, salary, LAG(salary) OVER (PARTITION BY department ORDER BY salary DESC) AS previous_salary, LEAD(salary) OVER (PARTITION BY department ORDER BY salary DESC) AS next_salary FROM employees;
✔ LAG() gets the previous row’s value
✔ LEAD() gets the next row’s value
Mini Task for You: Write an SQL query to assign a unique rank to employees based on their salary within each department using RANK().SELECT column1, column2, window_function() OVER (PARTITION BY column ORDER BY column) AS alias FROM table_name;
✔ PARTITION BY groups rows before applying the function
✔ ORDER BY determines the ranking or sequence
3️⃣ Using ROW_NUMBER()
🔹 Assign a unique row number to each employee based on salary (highest first)
SQL
SELECT name, department, salary, ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) AS row_num FROM employees;
✔ Each employee gets a unique row number within their department. 4️⃣ Using RANK() and DENSE_RANK() 🔹 Rank employees by salary within each departmentSQL
SELECT name, department, salary, RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS rank, DENSE_RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS dense_rank FROM employees;
✔ RANK() skips numbers when there’s a tie ✔ DENSE_RANK() does not skip numbers 5️⃣ Using NTILE() for Distribution 🔹 Divide employees into 4 salary groups per departmentSQL
SELECT name, department, salary, NTILE(4) OVER (PARTITION BY department ORDER BY salary DESC) AS salary_quartile FROM employees;
✔ Useful for dividing salaries into percentiles (e.g., top 25%, bottom 25%) 6️⃣ Running Total with SUM() OVER() 🔹 Calculate cumulative salary per departmentSQL
SELECT name, department, salary, SUM(salary) OVER (PARTITION BY department ORDER BY salary DESC) AS running_total FROM employees;
✔ Useful for tracking cumulative totals 7️⃣ Using LAG() and LEAD() 🔹 Compare an employee’s salary with the previous and next employee’s salarySQL
SELECT name, department, salary, LAG(salary) OVER (PARTITION BY department ORDER BY salary DESC) AS previous_salary, LEAD(salary) OVER (PARTITION BY department ORDER BY salary DESC) AS next_salary FROM employees; `
✔ LAG() gets the previous row’s value
✔ LEAD() gets the next row’s value
Mini Task for You: Write an SQL query to assign a unique rank to employees based on their salary within each department using RANK().WITH cte_name AS ( SELECT column1, column2 FROM table_name WHERE condition ) SELECT * FROM cte_name;
✔ The CTE cte_name is defined and then used in the main SELECT query.
2️⃣ Simple CTE Example
🔹 Find employees earning more than $70,000
WITH high_earners AS ( SELECT name, salary, department_id FROM employees WHERE salary > 70000 ) SELECT * FROM high_earners;
✔ The CTE high_earners filters employees with high salaries before selecting all columns from it.
3️⃣ CTE with Aggregation
🔹 Find departments where the average salary is above $80,000
WITH department_salary AS ( SELECT department_id, AVG(salary) AS avg_salary FROM employees GROUP BY department_id ) SELECT department_id, avg_salary FROM department_salary WHERE avg_salary > 80000;
✔ The CTE department_salary calculates the average salary per department and filters out low-paying ones.
4️⃣ CTE for Recursive Queries (Hierarchy Example)
🔹 Find an employee hierarchy (who reports to whom)
WITH RECURSIVE employee_hierarchy AS ( SELECT employee_id, name, manager_id FROM employees WHERE manager_id IS NULL -- Start with top-level manager UNION ALL SELECT e.employee_id, e.name, e.manager_id FROM employees e INNER JOIN employee_hierarchy eh ON e.manager_id = eh.employee_id ) SELECT * FROM employee_hierarchy;
✔ This recursive CTE finds an employee hierarchy starting from the top-level manager.
5️⃣ Why Use CTEs Instead of Subqueries?
✅ Better Readability – Makes complex queries easier to understand
✅ Reusability – Can be referenced multiple times in the main query
✅ Performance – Some databases optimize CTEs better than nested subqueries
Mini Task for You: Write an SQL query using a CTE to find departments with more than 5 employees.
You can find free SQL Resources here
👇👇
https://t.me/mysqldata
Like this post if you want me to continue covering all the topics! ❤️
Share with credits: https://t.me/sqlspecialist
Hope it helps :)
#sqlSELECT employees.name, employees.salary, departments.department_name FROM employees INNER JOIN departments ON employees.department_id = departments.department_id;
✔ Returns only employees who have a matching department.
3️⃣ LEFT JOIN (Includes Unmatched Rows from Left Table)
🔹 Find all employees, including those without a department
SELECT employees.name, employees.salary, departments.department_name FROM employees LEFT JOIN departments ON employees.department_id = departments.department_id;
✔ Includes employees even if they don’t have a department (NULL if no match).
4️⃣ RIGHT JOIN (Includes Unmatched Rows from Right Table)
🔹 Find all departments, including those without employees
SELECT employees.name, employees.salary, departments.department_name FROM employees RIGHT JOIN departments ON employees.department_id = departments.department_id;
✔ Includes all departments, even if no employees are assigned.
5️⃣ FULL JOIN (Includes Unmatched Rows from Both Tables)
🔹 Get a complete list of employees and departments (matched + unmatched rows)
SELECT employees.name, employees.salary, departments.department_name FROM employees FULL JOIN departments ON employees.department_id = departments.department_id;
✔ Includes all employees and departments even if there’s no match.SELECT department, COUNT(*) FROM employees GROUP BY department;
This groups employees by department and counts the number of employees in each department.
🔹 Find the total salary per department
SELECT department, SUM(salary) FROM employees GROUP BY department;
2️⃣ GROUP BY with Multiple Columns
You can group by multiple columns to analyze data more deeply.
🔹 Find the total salary for each job title within each department
SELECT department, job_title, SUM(salary) FROM employees GROUP BY department, job_title;
3️⃣ Using HAVING to Filter Groups
Unlike WHERE, which filters before aggregation, HAVING filters after aggregation.
🔹 Find departments with more than 5 employees
SELECT department, COUNT(*) AS employee_count FROM employees GROUP BY department HAVING COUNT(*) > 5;
🔹 Find departments where the total salary is greater than $500,000
SELECT department, SUM(salary) AS total_salary FROM employees GROUP BY department HAVING SUM(salary) > 500000;
🔹 Find job titles where the average salary is above $70,000
SELECT job_title, AVG(salary) AS avg_salary FROM employees GROUP BY job_title HAVING AVG(salary) > 70000;
4️⃣ GROUP BY with ORDER BY
To sort grouped results, use ORDER BY.
🔹 Find the total salary per department, sorted in descending order
SELECT department, SUM(salary) AS total_salary FROM employees GROUP BY department ORDER BY total_salary DESC;
Mini Task for You:
Write an SQL query to find departments where the average salary is more than $80,000.
Let me know when you’re ready to move to the next topic! 🚀SELECT order_id, customer_id, sales_amount, CASE WHEN sales_amount > 1000 THEN 'High' WHEN sales_amount BETWEEN 500 AND 1000 THEN 'Medium' ELSE 'Low' END AS sales_category FROM sales;
✅ This classifies each sale as High, Medium, or Low based on sales_amount.
Example 2: Handling NULL Values
SELECT employee_id, CASE WHEN department IS NULL THEN 'Not Assigned' ELSE department END AS department_status FROM employees;
✅ This replaces NULL values in the department column with "Not Assigned".
Example 3: Conditional Aggregation in Reports
SELECT SUM(CASE WHEN order_status = 'Completed' THEN total_amount ELSE 0 END) AS completed_sales, SUM(CASE WHEN order_status = 'Pending' THEN total_amount ELSE 0 END) AS pending_sales FROM orders;
✅ This calculates total sales separately for "Completed" and "Pending" orders.
Top 20 SQL Interview Questions
React with ❤️ if you want similar Interview Series for other data analytics topics
Share with credits: https://t.me/sqlspecialist
Hope it helps :)SELECT category_id, SUM(sales_amount) AS category_sales, (SUM(sales_amount) * 100.0) / SUM(SUM(sales_amount)) OVER () AS sales_percentage FROM sales GROUP BY category_id;
Explanation:
1️⃣ SUM(sales_amount) OVER () calculates the total sales across all categories.
2️⃣ SUM(sales_amount) * 100.0 / total_sales computes the percentage for each category.
3️⃣ GROUP BY category_id ensures aggregation at the category level.
Using a Subquery (Compatible with Older SQL Versions):
SELECT category_id, SUM(sales_amount) AS category_sales, (SUM(sales_amount) * 100.0) / (SELECT SUM(sales_amount) FROM sales) AS sales_percentage FROM sales GROUP BY category_id;
This works the same way but calculates total sales in a subquery.
Top 20 SQL Interview Questions
Like this post if you want me to continue this SQL Interview Series♥️
Share with credits: https://t.me/sqlspecialist
Hope it helps :)
متاح الآن! بحث تيليغرام 2025 — أهم رؤى العام 
