DBMS (3130703) Practical - 5 Name:-Mayur Premsing Jadhav Branch: - Co Shift-2 Batch: - EN No: - 84

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

DBMS (3130703)

PRACTICAL – 5
NAME :- MAYUR PREMSING JADHAV
BRANCH :- CO SHIFT-2
BATCH :-
EN No :- 84
1
1) Give details of cutomer ANIL :-
Query :
SELECT CURRENT_DATE "Date" FROM DUALSELECT * FROM DEPOSIT WHERE
CNAME='ANIL';
Output :

2) Give name of customers who are borrowers and depositors and having
loving city Nagpur :-
Query :
SELECT CNAME FROM CUSTOMERS WHERE CNAME IN(SELECT D.CNAME FROM
DEPOSIT D INNER JOIN BORROW B ON B.CNAME=D.CNAME) AND CITY='NAGPUR';
Output :

3) Give city as their city name of customers having same living branch:-
Query :
SELECT C.CITY FROM DEPOSIT D,BRANCH B,CUSTOMERS C WHERE
D.BNAME=B.BNAME AND D.CNAME=C.CNAME AND B.CITY=C.CITY;
Output :

4) Write a query to display the last name, dept number and dept name for all
the employees:-
Query :
SELECT EMP_NAME,E.DEPT_NO,DEPTCITY FROM EMPLOYEE E INNER JOIN
DEPARTMENT D ON D.DEPT_NO=E.DEPT_NO;
Output :

84/CO-SHIFT-2/SEM-III Page No. 1


2

5) Create a unique listing of all jobs that are in department 30. Include the
location of the department in the output :-
Query :
SELECT DISTINCT JOB_ID,JOB_TITLE,J.DEPT_NO,DEPTCITY FROM JOB J INNER JOIN
DEPARTMENT D ON D.DEPT_NO=J.DEPT_NO WHERE J.DEPT_NO=30;
Output :

6) Write a query to display employee name,dept number and dept name for
all employees who work in NEW YORK:-
Query :
SELECT EMP_NAME,E.DEPT_NO,DEPTCITY FROM DEPARTMENT D INNER JOIN
EMPLOYEE E ON E.DEPT_NO=D.DEPT_NO WHERE DEPTCITY='NEW YORK';
Output :

7) Display employee last name and employee number along with their
manager’s last name and manager number. Label the columns
Employee,Emp#,Manager and Mgr# respectively :-
Query :
SELECT E.EMP_NO "Emp#",E.EMP_NAME "Employee",E.MAN_NO
"Mgr#",M.EMP_NAME "Manager" FROM EMPLOYEE E,EMPLOYEE M WHERE
E.MAN_NO=M.EMP_NO ORDER BY "Emp#";
Output :

84/CO-SHIFT-2/SEM-III Page No. 2


3

8) Create a query to display the name and hire date of any employee hired
after employee SCOTT:-
Query :
SELECT EMP_NAME,HIRE_DATE FROM EMPLOYEE WHERE HIRE_DATE>(SELECT
HIRE_DATE FROM EMPLOYEE WHERE EMP_NAME='SCOTT');
Output :

84/CO-SHIFT-2/SEM-III Page No. 3

You might also like