Interview Prep
Interview questions, roadmaps and practice sets
Tutorials
Free tutorials on 30+ topics
Blog
Career guides, skills and interview tips
Free PDFs
Notes, cheat sheets and question banks
Certificates
Free skill tests and course certificates
Tools & Whiteboard
Free tools you can use right in the browser
Practice Tests
Mock tests, MCQs and quick Q&A
Free LMS
Learn on the Uncodemy LMS
Choose the best training program according to your career.
Improve the performance of your business with our innovative Industrial Training Program.
Read More →
Our instructor-led training classes are designed to make you an expert.
Read More →
Real-life case studies are a great way to demonstrate your practical knowledge.
Read More →
Explore blogs, latest technologies and industry updates with practical examples.
Read More →Browse all available training programs and choose the right one for your career.
Read More →Know more about who we are and what we stand for.
Discover our mission to equip individuals with essential IT skills and industry expertise.
Read More →
Free tutorials, interview questions, tools and calculators to help you learn.
Explore →Learn, practice and plan your career — bilkul free.
Book a free video counselling session and pick the right course for you.
Read More →This page lists Uncodemy's Advanced SQL Queries PDFs, each as its own file. Advanced SQL means writing readable multi-step queries with CTEs and subqueries, combining result sets, reshaping data with CASE, and making queries fast by reading execution plans and using indexes sensibly.
WITH dept_avg AS (
SELECT dept_id, AVG(salary) AS avg_salary
FROM employees
GROUP BY dept_id
)
SELECT e.name, e.salary
FROM employees e
JOIN dept_avg d ON e.dept_id = d.dept_id
WHERE e.salary > d.avg_salary;
Essential techniques every data analyst and SQL backend developer needs for high-volume data processing:
| Topic | What it solves |
|---|---|
| CTEs (WITH) | Break a complex query into named, readable steps |
| Subqueries and EXISTS | Filter or compare using another query's result |
| Set operations | UNION, UNION ALL, INTERSECT, EXCEPT to combine result sets |
| Conditional aggregation | Pivot rows into columns with SUM(CASE WHEN ...) |
| Recursive CTEs | Walk hierarchies such as managers, category trees and nested teams |
| Optimisation | Execution plans, indexes, sargable filters |
Toggle between production-tested query templates. Click the Copy Code button to paste directly into your SQL client:
-- Example: employees earning above their department average (tested)
-- A CTE computes each department's average, then a join compares each employee against it:
WITH dept_avg AS (
SELECT dept_id, AVG(salary) AS avg_salary
FROM employees
GROUP BY dept_id
)
SELECT e.name, e.salary
FROM employees e
JOIN dept_avg d ON e.dept_id = d.dept_id
WHERE e.salary > d.avg_salary;
NOT EXISTS or handle NULL values properly.