1. Find the second highest salary per department using DENSE_RANK.
2. Get daily login count trend for the past 15 days.3. Calculate user engagement duration using login/logout timestamps.
4. Identify duplicate transactions based on multiple columns.
5. Join user and transaction tables while handling NULLs correctly.
6. Retrieve top 5 products by revenue in the last 30 days.
7. Compute revenue delta between this month and last month.
8. Group data by week and count number of active users.
9. Perform LEFT JOIN with conditionally filtered rows.
10. Use CASE WHEN logic for tiering customers by total spend.
11. Check if transaction timestamps are in chronological order.
12. Handle missing values using COALESCE or default substitutions.
13. Track users with consecutive failed login attempts.
14. Find latest status per user using ROW_NUMBER partitioned by user ID.
15. Identify products with zero sales in the current quarter.
16. Join tables with SCD Type 1 dimension logic.
17. Apply HAVING clause to filter aggregate conditions.
18. Calculate average basket size per user per week.
19. Group and pivot sales data to display region-wise monthly totals.
20. Use Common Table Expressions (CTEs) to break complex logic into steps.
No comments:
Post a Comment