0% found this document useful (0 votes)
7 views3 pages

SQL (2)

The document contains a series of SQL queries using INNER JOIN to retrieve specific employee and department information from a database. Each query addresses different criteria, such as employee names, salaries, job titles, and department names based on various conditions. The examples demonstrate how to filter results based on attributes like salary thresholds, department names, and employee roles.

Uploaded by

gomalaj366
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)
7 views3 pages

SQL (2)

The document contains a series of SQL queries using INNER JOIN to retrieve specific employee and department information from a database. Each query addresses different criteria, such as employee names, salaries, job titles, and department names based on various conditions. The examples demonstrate how to filter results based on attributes like salary thresholds, department names, and employee roles.

Uploaded by

gomalaj366
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/ 3

ASSIGNMENT ON INNER JOIN :

1. NAME OF THE EMPLOYEE AND HIS LOCATION OF ALL THE EMPLOYEES.


Ans. SELECT ENAME, LOC

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO;

2. WAQTD DNAME AND SALARY FOR ALL THE EMPLOYEES WORKING IN


ACCOUNTING.
Ans. SELECT DNAME, SAL

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND DNAME = 'ACCOUNTING';

3. WAQTD DNAME AND ANNUAL SALARY OF EMPLOYEES WHOSE SALARY IS


MORE THAN 2340.
Ans. SELECT DNAME, SAL * 12

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND SAL > 2340;

4. WAQTD ENAME AND DNAME FOR EMPLOYEES HAVING CHARACTER 'A' IN


THEIR DNAME.
Ans. SELECT ENAME, DNAME

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND DNAME LIKE '%A%';

5. WAQTD ENAME AND DNAME FOR ALL THE EMPLOYEES WORKING AS


SALESMAN.
Ans. SELECT ENAME, DNAME

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO AND JOB = 'SALESMAN';


6. WAQTD DNAME AND JOB FOR ALL THE EMPLOYEES WHOSE JOB AND DNAME
START WITH CHARACTER 'S'.
Ans. SELECT DNAME, JOB

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND JOB LIKE 'S%'

AND DNAME LIKE 'S%';

7. WAQTD DNAME AND MGR NO FOR EMPLOYEES REPORTING TO 7839.


Ans. SELECT DNAME, MGR

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND MGR = 7839;

8. WAQTD DNAME AND HIREDATE FOR EMPLOYEES HIRED AFTER 1983 INTO
ACCOUNTING OR RESEARCH DEPT.
Ans. SELECT DNAME, HIREDATE

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND HIREDATE > '31-DEC-1983'

AND DNAME IN ('ACCOUNTING', 'RESEARCH');

9. WAQTD ENAME AND DNAME OF THE EMPLOYEES WHO ARE GETTING COMM
IN DEPT 10 OR 30.
Ans. SELECT ENAME, DNAME

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND COMM IS NOT NULL

AND EMP.DEPTNO IN (10, 30);


10. WAQTD DNAME AND EMPNO FOR ALL THE EMPLOYEES WHOSE EMPNO ARE
(7839, 7902) AND ARE WORKING IN LOC NEW YORK.
Ans. SELECT DNAME, EMPNO

FROM EMP, DEPT

WHERE EMP.DEPTNO = DEPT.DEPTNO

AND EMPNO IN (7839, 7902)

AND LOC = 'NEW YORK';

You might also like