100% found this document useful (1 vote)
104 views3 pages

Lab Practice Sheet - 7 (JOINS)

dfbfbdfbd

Uploaded by

ayush.saxena0412
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
100% found this document useful (1 vote)
104 views3 pages

Lab Practice Sheet - 7 (JOINS)

dfbfbdfbd

Uploaded by

ayush.saxena0412
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
You are on page 1/ 3

Department of CSE (AI/AI&ML)

Lab- 7 (JOINS)

Objective: At the end of the assignment, students will be able to apply JOINS (
INNER/NATURAL/OUTER/CROSS) and perform Set Operations ( UNION/INTERSECT/MINUS)
using more than one table.

depositor: borrower: customer:

account: branch:

Solve below given queries using above schemas


1. Find customer ids of those customers who are borrower from the banks and who
appear in the list of account holders.
2. Find those customer names who are borrower.
3. Find the name of the customers who have a loan from the bank, but do not have an
account at the bank.
4. Get the Customer Id and name of those customers who have both account and loan
from the bank.
5. Get Branch Name of the branch having highest average balance amongst all branches.
6. Find the names of all branches that have assets greater than those of at least one
branch located in NOIDA. Use some
7. Find the names of all branches that have assets greater than that of each branch
located in NOIDA. (Use All)
Department of CSE (AI/AI&ML)

Objective 2: Solve below queries using HR Schema Using JOINS execute the given question
1. Display last name, job title of employees who have commission percentage and belongs to
department 30.
2. Write a query to display the last name, job, department number, and department name for all
employees who work in Toronto.
3. Display the employee last name and department name for all employees who have an a
(lowercase) in their last names.
4. Write a query to display the employee last name, department name, location ID, and city of
all employees who earn a commission.
5. Create a unique listing of all jobs that are in department 80. Include the location of the
department in the output.
6. Write a query to display the last name, department number, and department name for all
employees.
7. Write a query in SQL to display the first name, last name, salary, and job grade for all
employees.
8. Write a query in SQL to display the first name, last name, department number and department
name, for all employees for departments 80 or 40.
9. Write a query in SQL to display those employees who contain a letter z to their first name and
also display their last name, department, city, and state province.
10. Write a query in SQL to display all departments including those where does not have any
employee.
11. Write a query in SQL to display the department name, city, and state province for each
department.
12. Write a query in SQL to display the first name, last name, department number and name, for
all employees who have or have not any department.
13. Write a query in SQL to display department name and the full name (first and last name) of
the manager.
14. Write a query in SQL to display department name and the full name (first and last name) of
the manager.
15. Write a query in SQL to display the full name (first and last name), and salary of those
employees who working in any department located in London.
16. Write a query in SQL to display full name(first and last name), job title, starting and ending
date of last jobs for those employees with worked without a commission percentage.
17. Write a query in SQL to display the full name (firt and last name ) of employee with ID and
name of the country presently where (s)he is working.
18. Write a query in SQL to display the job title, department name, full name (first and last
name ) of employee, and starting date for all the jobs which started on or after 1st January,
1993 and ending with on or before 31 August, 1997.
19. Write a query in SQL to display the full name (first and last name ) of employee, and job title
of those employees who is working in the department which ID 80 and deserve a commission
percentage.
Department of CSE (AI/AI&ML)

20. Write a query in SQL to display job title, full name (first and last name ) of employee, and the
difference between maximum salary for the job and salary of the employee.

Objective 3: Miscellaneous SQL Queries using HR schema

21. Display manager ID and number of employees managed by the manager.


22. Select manager_id, count(employee_id) “no of emp” from employees group by manager_id;
23. Display the country ID and number of cities we have in the country.
24. Display number of employees joined after 15th of the July .
25. Display average salary of employees in each department who have commission percentage.
26. Display job ID, number of employees, sum of salary, and difference between highest salary
and lowest salary of the employees of the job.
27. Display job ID for jobs with average salary more than 10000.
28. Display departments in which more than five employees have commission percentage.
29. Display employee ID for employees who did more than one job in the past.
30. Display the manager id who is managing more than 5 employees.
31. Display last name, job ID of employees who have commission percentage and belongs to
department 30.
32. Display job ID and average salary of employees
33. Display job title, employee name, and the difference between maximum salary for the job and
salary of the employee.

You might also like