SQL Programming Resources
Find top SQL resources from global universities, cool projects, and learning materials for data analytics. Admin: @coderfun Useful links: heylink.me/DataAnalytics Promotions: @love_data
إظهار المزيد📈 نظرة تحليلية على قناة تيليجرام SQL Programming Resources
تُعد قناة SQL Programming Resources (@sqlanalyst) في القطاع اللغوي الإنكليزية لاعباً نشطاً. يضم المجتمع حالياً 75 988 مشتركاً، محتلاً المرتبة 1 692 في فئة التكنولوجيات والتطبيقات والمرتبة 4 136 في منطقة الهند.
📊 مؤشرات الجمهور والحراك
منذ تأسيسه في невідомо، حقق المشروع نمواً سريعاً وجمع 75 988 مشتركاً.
بحسب آخر البيانات بتاريخ 28 يونيو, 2026، تحافظ القناة على نشاط مستقر. خلال آخر 30 يوماً تغيّر عدد الأعضاء بمقدار 373، وفي آخر 24 ساعة بمقدار -10، مع بقاء الوصول العام مرتفعاً.
- حالة التحقق: غير موثّقة
- معدل التفاعل (ER): يبلغ متوسط تفاعل الجمهور 2.35%. وخلال أول 24 ساعة من النشر يحصد المحتوى عادةً 1.03% من ردود الفعل نسبةً إلى إجمالي المشتركين.
- وصول المنشورات: يحصل كل منشور على متوسط 1 783 مشاهدة. وخلال اليوم الأول يجمع عادةً 786 مشاهدة.
- التفاعلات والاستجابة: يتفاعل الجمهور بانتظام؛ متوسط التفاعلات لكل منشور يبلغ 3.
- الاهتمامات الموضوعية: يركز المحتوى على مواضيع رئيسية مثل row, sql, customer_id, logic, desc.
📝 الوصف وسياسة المحتوى
يصف المؤلف القناة بأنها مساحة للتعبير عن الآراء الذاتية:
“Find top SQL resources from global universities, cool projects, and learning materials for data analytics.
Admin: @coderfun
Useful links: heylink.me/DataAnalytics
Promotions: @love_data”
بفضل وتيرة التحديث المرتفعة (أحدث البيانات بتاريخ 29 يونيو, 2026) تحافظ القناة على حداثتها ومستوى وصول مرتفع. وتُظهر التحليلات تفاعلاً نشطاً من الجمهور، ما يجعلها نقطة تأثير مهمة ضمن فئة التكنولوجيات والتطبيقات.
SELECT c.customer_id
FROM customers c
LEFT JOIN orders o
ON c.customer_id = o.customer_id
GROUP BY c.customer_id
HAVING MAX(order_date) < CURRENT_DATE - INTERVAL '90 days'
OR MAX(order_date) IS NULL;
📌 Question 52: Calculate Average Revenue Per User ARPU
Tables: users (user_id), orders (user_id, amount)
SELECT
ROUND(
SUM(amount) * 1.0 /
COUNT(DISTINCT u.user_id),
2
) AS arpu
FROM users u
LEFT JOIN orders o
ON u.user_id = o.user_id;
📌 Question 53: Find the Fastest Selling Product
Table: inventory (product_id, launch_date)
Table: sales (product_id, sale_date)
Requirement: Find the product with the fewest days from launch to first sale.
WITH first_sale AS (
SELECT
product_id,
MIN(sale_date) AS first_sale_date
FROM sales
GROUP BY product_id
)
SELECT
i.product_id,
(first_sale_date - launch_date) AS days_to_sell
FROM inventory i
JOIN first_sale f
ON i.product_id = f.product_id
ORDER BY days_to_sell
LIMIT 1;
📌 Question 54: Find Customers Who Purchased in Every Quarter
Table: orders (customer_id, order_date)
WITH customer_quarters AS (
SELECT
customer_id,
COUNT(
DISTINCT DATE_TRUNC('quarter', order_date)
) AS quarter_count
FROM orders
GROUP BY customer_id
),
total_quarters AS (
SELECT COUNT(
DISTINCT DATE_TRUNC('quarter', order_date)
) AS total_quarters
FROM orders
)
SELECT customer_id
FROM customer_quarters
CROSS JOIN total_quarters
WHERE quarter_count = total_quarters;
📌 Question 55: Find Revenue Contribution of Top 10 Customers
Table: orders (customer_id, amount)
WITH customer_revenue AS (
SELECT
customer_id,
SUM(amount) AS revenue
FROM orders
GROUP BY customer_id
)
SELECT
SUM(revenue) AS top10_revenue,
ROUND(
100.0 * SUM(revenue) /
(
SELECT SUM(amount)
FROM orders
),
2
) AS contribution_pct
FROM (
SELECT revenue
FROM customer_revenue
ORDER BY revenue DESC
LIMIT 10
) t;
📌 Question 56: Find Products Never Returned
Tables:
products (product_id)
sales (order_id, product_id)
returns (order_id)
SELECT DISTINCT
p.product_id
FROM products p
LEFT JOIN sales s
ON p.product_id = s.product_id
LEFT JOIN returns r
ON s.order_id = r.order_id
WHERE r.order_id IS NULL;
📌 Question 57: Calculate Daily Revenue Growth
Table: sales (sale_date, amount)
WITH daily_sales AS (
SELECT
sale_date,
SUM(amount) AS revenue
FROM sales
GROUP BY sale_date
)
SELECT
sale_date,
revenue,
ROUND(
100.0 *
(
revenue -
LAG(revenue) OVER(
ORDER BY sale_date
)
/
LAG(revenue) OVER(
ORDER BY sale_date
),
2
) AS growth_pct
FROM daily_sales;
📌 Question 58: Find the Most Loyal Customers
Table: orders (customer_id, order_date)
Requirement: Customers who placed orders in the highest number of distinct months.
SELECT
customer_id,
COUNT(
DISTINCT DATE_TRUNC('month', order_date)
) AS active_months
FROM orders
GROUP BY customer_id
ORDER BY active_months DESC
LIMIT 10;
📌 Question 59: Find Products With Zero Sales
Tables:
products (product_id)
sales (product_id)
SELECT
p.product_id
FROM products p
LEFT JOIN sales s
ON p.product_id = s.product_id
WHERE s.product_id IS NULL;
📌 Question 60: Calculate Average Orders Per Customer
Table: orders (customer_id)
SELECT
ROUND(
COUNT(*) * 1.0 /
COUNT(DISTINCT customer_id),
2
) AS avg_orders_per_customer
FROM orders;
❤️ Double Tap For MoreSELECT
EXTRACT(HOUR FROM order_timestamp) AS order_hour,
COUNT(*) AS total_orders
FROM orders
GROUP BY order_hour
ORDER BY total_orders DESC
LIMIT 1;
📌 Question 40: Rank Salespersons by Quarterly Revenue
Table: sales salesperson_id, amount, sale_date
WITH quarterly_sales AS (
SELECT
salesperson_id,
DATE_TRUNC('quarter', sale_date) AS quarter,
SUM(amount) AS revenue
FROM sales
GROUP BY 1,2
)
SELECT *,
DENSE_RANK() OVER (
PARTITION BY quarter
ORDER BY revenue DESC
) AS sales_rank
FROM quarterly_sales;
Double Tap ❤️ For MoreSELECT
EXTRACT(HOUR FROM order_timestamp) AS order_hour,
COUNT(*) AS total_orders
FROM orders
GROUP BY order_hour
ORDER BY total_orders DESC
LIMIT 1;
📌 Question 40: Rank Salespersons by Quarterly Revenue
Table: sales salesperson_id, amount, sale_date
WITH quarterly_sales AS (
SELECT
salesperson_id,
DATE_TRUNC('quarter', sale_date) AS quarter,
SUM(amount) AS revenue
FROM sales
GROUP BY 1,2
)
SELECT *,
DENSE_RANK() OVER (
PARTITION BY quarter
ORDER BY revenue DESC
) AS sales_rank
FROM quarterly_sales;
Double Tap ❤️ For More
-----
1.38 ₽ · /balance_helpWITH monthly_spend AS (
SELECT
customer_id,
DATE_TRUNC('month', order_date) AS month,
SUM(amount) AS total_spend
FROM orders
GROUP BY customer_id, DATE_TRUNC('month', order_date)
)
SELECT
customer_id,
month,
total_spend
FROM (
SELECT *,
LAG(total_spend) OVER (
PARTITION BY customer_id
ORDER BY month
) AS prev_spend
FROM monthly_spend
) t
WHERE total_spend > prev_spend;
📌 Question 32: Find Products Purchased Together Most Often
Table: order_items order_id, product_id
SELECT
a.product_id AS product_1,
b.product_id AS product_2,
COUNT(*) AS frequency
FROM order_items a
JOIN order_items b
ON a.order_id = b.order_id
AND a.product_id < b.product_id
GROUP BY 1,2
ORDER BY frequency DESC
LIMIT 10;
📌 Question 33: Find Users Active for 7 Consecutive Days
Table: user_activity user_id, activity_date
WITH activity AS (
SELECT
user_id,
activity_date,
activity_date -
ROW_NUMBER() OVER (
PARTITION BY user_id
ORDER BY activity_date
) * INTERVAL '1 day' AS grp
FROM user_activity
)
SELECT
user_id
FROM activity
GROUP BY user_id, grp
HAVING COUNT(*) >= 7;
📌 Question 34: Calculate Repeat Purchase Rate
Table: orders customer_id, order_id
SELECT
ROUND(
100.0 *
COUNT(CASE WHEN order_count > 1 THEN 1 END) /
COUNT(*),
2
) AS repeat_purchase_rate
FROM (
SELECT
customer_id,
COUNT(*) AS order_count
FROM orders
GROUP BY customer_id
) t;
📌 Question 35: Find the Longest Gap Between Two Orders
Table: orders customer_id, order_date
WITH gaps AS (
SELECT
customer_id,
order_date,
order_date -
LAG(order_date) OVER (
PARTITION BY customer_id
ORDER BY order_date
) AS gap_days
FROM orders
)
SELECT
customer_id,
MAX(gap_days) AS longest_gap
FROM gaps
GROUP BY customer_id;
📌 Question 36: Calculate Revenue Lost Due to Churn
Tables: customers customer_id, status, orders customer_id, amount
SELECT
SUM(amount) AS churned_revenue
FROM customers c
JOIN orders o
ON c.customer_id = o.customer_id
WHERE c.status = 'Churned';
📌 Question 37: Find the Fastest Growing Product
Table: sales product_id, amount, sale_date
WITH monthly_sales AS (
SELECT
product_id,
DATE_TRUNC('month', sale_date) AS month,
SUM(amount) AS revenue
FROM sales
GROUP BY 1,2
)
SELECT *
FROM (
SELECT *,
revenue -
LAG(revenue) OVER (
PARTITION BY product_id
ORDER BY month
) AS growth
FROM monthly_sales
) t
ORDER BY growth DESC
LIMIT 1;
📌 Question 38: Find Customers Who Purchased Every Product Category
Tables: products product_id, category, orders customer_id, product_id
SELECT
customer_id
FROM orders o
JOIN products p
ON o.product_id = p.product_id
GROUP BY customer_id
HAVING COUNT(DISTINCT category) = (
SELECT COUNT(DISTINCT category)
FROM products
);
📌 Question 39: Find Peak Ordering Hour
Table: orders order_id, order_timestampSELECT
customer_id,
MIN(order_date) AS first_purchase_date
FROM orders
GROUP BY customer_id;
📌 Question 22: Calculate Customer Lifetime Value (CLV)
Table: orders customer_id, amount
Requirement: Total revenue generated by each customer.
SELECT
customer_id,
SUM(amount) AS lifetime_value
FROM orders
GROUP BY customer_id
ORDER BY lifetime_value DESC;
📌 Question 23: Find the Top 5 Products Contributing 80% of Revenue
Table: sales product_id, amount
WITH product_revenue AS (
SELECT
product_id,
SUM(amount) AS revenue
FROM sales
GROUP BY product_id
),
revenue_rank AS (
SELECT
product_id,
revenue,
SUM(revenue) OVER (ORDER BY revenue DESC) AS running_revenue,
SUM(revenue) OVER () AS total_revenue
FROM product_revenue
)
SELECT
product_id,
revenue,
ROUND(100.0 * running_revenue / total_revenue, 2) AS cumulative_pct
FROM revenue_rank
WHERE running_revenue <= total_revenue * 0.80;
📌 Question 24: Find Customers Who Purchased More Than 3 Different Products
Table: orders customer_id, product_id
SELECT
customer_id
FROM orders
GROUP BY customer_id
HAVING COUNT(DISTINCT product_id) > 3;
📌 Question 25: Find the Highest Revenue Order for Each Customer
Table: orders order_id, customer_id, amount
WITH ranked_orders AS (
SELECT *,
ROW_NUMBER() OVER (
PARTITION BY customer_id
ORDER BY amount DESC
) AS rn
FROM orders
)
SELECT
customer_id,
order_id,
amount
FROM ranked_orders
WHERE rn = 1;
📌 Question 26: Calculate Average Time Between Orders
Table: orders customer_id, order_date
WITH order_gap AS (
SELECT
customer_id,
order_date,
LAG(order_date) OVER (
PARTITION BY customer_id
ORDER BY order_date
) AS previous_order
FROM orders
)
SELECT
customer_id,
AVG(order_date - previous_order) AS avg_days_between_orders
FROM order_gap
WHERE previous_order IS NOT NULL
GROUP BY customer_id;
📌 Question 27: Find Users Who Abandoned Their Cart
Tables: cart user_id, product_id, orders user_id
Requirement: Users who added items to their cart but never completed a purchase.
SELECT DISTINCT
c.user_id
FROM cart c
LEFT JOIN orders o
ON c.user_id = o.user_id
WHERE o.user_id IS NULL;
📌 Question 28: Find Revenue Generated by New vs Returning Customers
Tables: users user_id, signup_date, orders user_id, amount, order_date
SELECT
CASE
WHEN DATE_TRUNC('month', signup_date) =
DATE_TRUNC('month', order_date)
THEN 'New'
ELSE 'Returning'
END AS customer_type,
SUM(amount) AS revenue
FROM users u
JOIN orders o
ON u.user_id = o.user_id
GROUP BY customer_type;
📌 Question 29: Find the Most Frequently Purchased Product Pair
Table: order_items order_id, product_id
SELECT
a.product_id AS product_1,
b.product_id AS product_2,
COUNT(*) AS pair_count
FROM order_items a
JOIN order_items b
ON a.order_id = b.order_id
AND a.product_id < b.product_id
GROUP BY
a.product_id,
b.product_id
ORDER BY pair_count DESC
LIMIT 1;
📌 Question 30: Calculate Revenue Contribution by Region
Tables: customers customer_id, region, orders customer_id, amount
SELECT
c.region,
SUM(o.amount) AS revenue,
ROUND(
100.0 * SUM(o.amount) /
SUM(SUM(o.amount)) OVER (),
2
) AS revenue_share
FROM customers c
JOIN orders o
ON c.customer_id = o.customer_id
GROUP BY c.region
ORDER BY revenue DESC;
Double Tap ❤️ For More
متاح الآن! بحث تيليغرام 2025 — أهم رؤى العام 
