This document contains 9 SQL queries:
1) Finds last names and hire dates of employees in the same department as SCOTT excluding SCOTT
2) Finds customer names who bank at the same branch city as Mr. Sunil
3) Finds deposit and loan details for customers in the same city as Pramod
4) Finds employee numbers and last names of those earning more than the average salary sorted by salary
5) Finds customer names who bank in the same city as Mr. Anil with deposits over 2000
6) Finds last names and salaries of employees reporting to Ford
7) Finds the branch name with the highest number of depositors
8) Finds cities with the maximum number of
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
196 views
Gtu Practical 7
This document contains 9 SQL queries:
1) Finds last names and hire dates of employees in the same department as SCOTT excluding SCOTT
2) Finds customer names who bank at the same branch city as Mr. Sunil
3) Finds deposit and loan details for customers in the same city as Pramod
4) Finds employee numbers and last names of those earning more than the average salary sorted by salary
5) Finds customer names who bank in the same city as Mr. Anil with deposits over 2000
6) Finds last names and salaries of employees reporting to Ford
7) Finds the branch name with the highest number of depositors
8) Finds cities with the maximum number of
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
(1) Write a query to display the last name and hire date of any employee in the
same department as SCOTT. Exclude SCOTT
==> select emp_name,hire_date from employee group by dept_no where emp_name!='an amika'; (2) Give name of customers who are depositors having same branch city of mr. sun il. ==> select cname from deposit where bname in(select bname from deposit where cna me='sunil'); (3) Give deposit details and loan details of customer in same city where pramod is living. ==> select * from deposit,loan where bname in(select bname from customers where cname='PRAMOD'); (4) Create a query to display the employee numbers and last names of all employe es who earn more than the average salary. Sort the results in ascending order of salary. ==> select emp_name,emp_no from employee where emp_sal>(select avg(emp_sal) from employee) order by emp_sal; (5) Give names of depositors having same living city as mr. anil and having depo sit amount greater than 2000 ==> select cname from deposit where bname in(select bname from customers where c name='sunil') and amount>2000; (6) Display the last name and salary of every employee who reports to ford. ==> select cname from employee (8) List the name of branch having highest number of depositors. ==> select bname from deposit where amount in( select max(amount) from deposit); (9) Give the name of cities where in which the maximum numbers of branches are l ocated. ==> select b1.city from branch b1 group by b1.city having count(b1.bname)>ALL(se lect count(b2.bname) from branch b2 where b1.city=b2.city group by b2.city);