0% found this document useful (0 votes)
24 views10 pages

Joins Practice

Sql

Uploaded by

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

Joins Practice

Sql

Uploaded by

Omama Arshad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

JOINS PRACTICE:

DOWNLOAD SQL SCRIPT FOR THESE QUERIES:


https://drive.google.com/file/d/1P_1ikTIg8I9Q2eHx9
XUjwG4gVEs_Os2t/view?usp=sharing

1. Retrieve all employees and their corresponding


department names:

2. Retrieve employees along with their project names:

3. Find employee names and their roles:

4. Retrieve employees and their addresses:

5. Retrieve employees with both role and address


information:

6. Retrieve all employees, including those who don't


have a department assigned:
7. Retrieve all employees and their project names,
even if they aren't assigned to a project:

8. Retrieve all employees and their roles, even if they


have no assigned role:

9. Find all employees and their addresses, even if


they don’t have an address in the database:

10. Retrieve all employees with or without both role


and address information:

11. Retrieve all departments and their employees:

12. Retrieve all projects and the employees assigned


to them:
13. Find all roles and the corresponding employees
assigned to them:

14. Retrieve all addresses and their respective


employees:

15. Retrieve all employee roles and their


departments:

16. Retrieve employee names in uppercase, along


with their department names:

17. Concatenate employee names and their roles,


ordered by the start date:

18. Retrieve all employees and their department


names, even if the employee has no department or
the department has no employees:
19. Retrieve all employees and their project names,
even if they aren't assigned to a project or if a
project has no employees:

20. Retrieve all employees and their roles, even if


the employee has no role or if a role has no
employee:

21. Retrieve all employees and their addresses,


even if the employee has no address or the
address has no employee:

22. Retrieve all employees, their departments, and


their roles, even if the department or role has no
corresponding employee:

23. Retrieve all possible combinations of employees


and departments:

24. Retrieve all possible combinations of employees


and projects:
25. Find all possible combinations of employees and
roles:
26. Retrieve all possible combinations of employees
and addresses:

27. Retrieve all possible combinations of employees,


roles, and projects:

28. Concatenate employee names with their


department and project names:

29. Find employees and their roles, replacing


'Developer' with 'Engineer':

30. List employees and their roles in uppercase with


the length of their names:

31. Retrieve the longest employee name and the


department they work in:

32. Retrieve employees whose project names


contain the letter 'A':
33. Find employees with their addresses and city
names converted to uppercase:

34. Retrieve employees and their departments,


ensuring every employee is listed, even those
without a department:

35. Retrieve all employees, roles, and project


names:

36. List employees with their roles and the number of


characters in their role:

37. Retrieve the employees whose names start with


the same letter as their department names:

38. Retrieve all project names with their


corresponding employee names, even if they are
not assigned to a project:

39. Find employees whose roles started in the year


2021:
40. Retrieve all employees and their roles, ensuring
that employees without a role are included:

41. Retrieve employees and the total length of their


name and role combined:

42. Retrieve employees and their role descriptions,


ensuring that every role is listed, even if an
employee isn't assigned to it:

43. Retrieve employees and the length of their


department name, replacing 'Marketing' with
'Sales':

44. Retrieve employees who work on 'Project A' or


'Project B', sorted by their department:

45. List all employees and their roles, concatenated


with their project names:

46. Retrieve employees and concatenate their


department and project names, ensuring all
employees are included:
47. List all employees and their roles, concatenated
with their address in uppercase:

48. Retrieve employees who are working on 'Project


A' or have no project assigned:

49. Find employees and departments where their


names share at least three characters:

50. Retrieve employees whose project name


contains a letter 'T' and who also work in the
'Finance' department:

51. Retrieve employees with their department names


in uppercase and project names in lowercase:

52. Find employees and their departments, ensuring


all employees and departments are listed even if
they don’t match:

53. Retrieve employees, concatenating their role and


department names, sorted by the length of the
concatenated string:
54. List employees with their roles and projects,
sorted by the length of their project names:

55. Retrieve the longest employee name and the


project they are working on:

56. Retrieve all employees and their projects, sorted


by the length of their names concatenated with
their project names:

SELF JOINS:

1. Find Employees Working on the Same


Project

2. Find Employees in the Same Department

3. Find Employees Living in the Same City

4. Find Employees With the Same Role

5. Find Employees Working in Different


Projects But the Same Department
6. Compare Employees with Different Salaries
in the Same Department

7. Find Employees with Overlapping Project


Dates

You might also like