0% found this document useful (0 votes)
21 views4 pages

Easy (20 Questions) Inner Join Left Join Right Join Full Outer Join Inner Join Left Join Right Join

The document contains a list of SQL query tasks categorized into three difficulty levels: Easy, Medium, and Hard. Each task involves various types of SQL joins (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN) and operations such as filtering, grouping, and aggregate functions. The queries focus on retrieving employee and department data based on specific conditions and requirements.

Uploaded by

Omkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views4 pages

Easy (20 Questions) Inner Join Left Join Right Join Full Outer Join Inner Join Left Join Right Join

The document contains a list of SQL query tasks categorized into three difficulty levels: Easy, Medium, and Hard. Each task involves various types of SQL joins (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN) and operations such as filtering, grouping, and aggregate functions. The queries focus on retrieving employee and department data based on specific conditions and requirements.

Uploaded by

Omkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🟡 Easy (20 Questions)

1. Show all employees with their department names using INNER JOIN.
2. Show all employees with their department names using LEFT JOIN.
3. Show all departments with the employees working in them using RIGHT
JOIN.
4. Show all employees and all departments using FULL OUTER JOIN.
5. List all employees who have a department assigned (INNER JOIN).
6. List employees without a department (LEFT JOIN with WHERE
department_name IS NULL).
7. List all departments without employees (RIGHT JOIN with WHERE emp_id
IS NULL).
8. Show emp_id, emp_name, and department_name sorted by employee
name (INNER JOIN).
9. Show employees from the IT department (INNER JOIN with WHERE
department_name = 'IT').
[Link] all employees in ascending order of department_id (LEFT JOIN).
[Link] all departments in ascending order of department_id (RIGHT JOIN).
[Link] employees whose department_id is 103 (INNER JOIN).
[Link] all employees and their departments, if any (FULL OUTER JOIN).
[Link] employees in the Finance department (INNER JOIN).
[Link] all departments starting with 'M' and their employees (RIGHT JOIN).
[Link] employees and departments where both IDs are the same (INNER
JOIN).
[Link] all employees and department names in descending salary order
(assume salary column exists) (INNER JOIN).
[Link] all employees and departments where department_id is not NULL
(INNER JOIN).
[Link] employees who do not have matching department names (LEFT JOIN,
WHERE department_name IS NULL).
[Link] employees in departments IT or Finance (INNER JOIN).
🟡 Medium (20 Questions)
Join + filtering, grouping, aggregate functions.
[Link] the count of employees in each department (INNER JOIN + GROUP
BY).
[Link] the count of employees including those without a department (LEFT
JOIN + GROUP BY).
[Link] departments with more than 2 employees (INNER JOIN + GROUP BY
+ HAVING).
[Link] all departments and the number of employees in them (RIGHT JOIN
+ GROUP BY).
[Link] all employees who work in departments with names ending in 'e'
(INNER JOIN).
[Link] employees joined after 2020 with their department names (INNER
JOIN).
[Link] the average salary of employees in each department (INNER JOIN).
[Link] the maximum salary in each department, including departments
without employees (LEFT JOIN).
[Link] the minimum salary for each department (INNER JOIN).
[Link] all employees whose department name contains 'a' (INNER JOIN +
LIKE).
[Link] all employees and their departments, sorted by department name
(LEFT JOIN).
[Link] all departments with no employees (RIGHT JOIN + WHERE emp_id
IS NULL).
[Link] all employees without a department (LEFT JOIN + WHERE
department_name IS NULL).
[Link] all employees and their departments, replacing NULL department
names with 'No Department' (LEFT JOIN + COALESCE).
[Link] the department with the highest number of employees (INNER JOIN
+ GROUP BY + ORDER BY COUNT(*) DESC LIMIT 1).
[Link] the department with the lowest salary employee (INNER JOIN +
ORDER BY salary ASC LIMIT 1).
[Link] the average age of employees in each department (INNER JOIN).
[Link] employees who belong to departments with average salary > 60000
(INNER JOIN + HAVING).
[Link] employees working in a department but whose name does not
match exactly (INNER JOIN with mismatch criteria).
[Link] the number of employees per department, including 0 where no
employees (RIGHT JOIN).

🔴 Hard (20 Questions)


Complex joins, multiple joins, conditions, subqueries.
[Link] employees who do not belong to any department but still exist in
employees (LEFT JOIN).
[Link] departments with no employees and employees with no
departments (FULL OUTER JOIN).
[Link] employees in departments where the total salary exceeds 200000
(INNER JOIN + GROUP BY + HAVING).
[Link] employees in the top 3 departments by employee count (INNER JOIN
+ GROUP BY + LIMIT).
[Link] employees in departments that have at least 1 employee earning
more than 80000 (INNER JOIN + EXISTS).
[Link] employees and departments where department name and employee
name start with the same letter (INNER JOIN).
[Link] employees who work in departments without repeating department
names (INNER JOIN + DISTINCT).
[Link] all employees, their departments, and also a column showing
whether they have a department assigned (LEFT JOIN + CASE).
[Link] all employees from employees table and match department name
with a second table of department heads (JOIN with 3 tables).
[Link] all employees whose department name length > 5 (INNER JOIN +
LENGTH).
[Link] employees in departments that have more than 5 employees with
salary above 50000 (INNER JOIN + nested GROUP BY).
[Link] employees in departments located in a certain city (JOIN with
location table).
[Link] employees who joined before the department was created (JOIN
with department creation date table).
[Link] employees without departments but with bonuses over 5000 (LEFT
JOIN).
[Link] employees whose departments have a null department name
(INNER JOIN).
[Link] all employees and departments, replacing missing names with
'Unknown' (FULL OUTER JOIN + COALESCE).
[Link] the highest paid employee in each department (INNER JOIN +
GROUP BY + MAX).
[Link] the department that has the least total salary (INNER JOIN +
GROUP BY + MIN).
[Link] employees and their departments, ordered first by department then
by salary (INNER JOIN).
[Link] employees in departments that have no manager assigned (JOIN
with managers table).

You might also like