0% found this document useful (0 votes)
30 views2 pages

Assignment For Today Joins: SELECT Emp - Ename, Emp - Deptno, Dept - Dname FROM SCOTT - EMP Inner Join Scott - Dept On 1 1

The document provides instructions for completing SQL joins and group by exercises. It asks the reader to write queries to list employee names with their department names using a join, employee names with their manager's name using a join, and employees who work in the research department.

Uploaded by

rajeshec83
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
30 views2 pages

Assignment For Today Joins: SELECT Emp - Ename, Emp - Deptno, Dept - Dname FROM SCOTT - EMP Inner Join Scott - Dept On 1 1

The document provides instructions for completing SQL joins and group by exercises. It asks the reader to write queries to list employee names with their department names using a join, employee names with their manager's name using a join, and employees who work in the research department.

Uploaded by

rajeshec83
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 2

SELECT emp.ename, emp.deptno, dept.dname FROM SCOTT.EMP inner join scott.

dept on 1=1

Assignment for today


 
Joins
1.            List employee name, department number and their corresponding department name.

SELECT emp.ename, emp.deptno, dept.dname FROM SCOTT.EMP inner join scott.dept on 1=1

2.            List employee name and their manager name

SELECT e1.last_name||' works for '||e2.last_name

"Employees and Their Managers"

FROM hr.employees e1, hr.employees e2

WHERE e1.manager_id = e2.employee_id

AND e1.last_name LIKE 'R%'


ORDER BY e1.last_name

3.            List employees who work in Research department


4.            List all rows from EMP table and only the matching rows from DEPT table.
5.            List all rows from EMP table and only the matching rows from DEPT table.
 
Group by clause
1.            List the count and average salary for employees in department 20.
2.            List names of employees who are older than 30 years in the company.
3.            List the employee name , hire date in the descending order of the hire date.
4.            List employee name, salary, PF, HRA, DA and gross; order the results in the ascending order
of gross. HRA is 50% of the salary and DA is 30% of the salary.
5.            List the department numbers and number of employees in each department.
 
1.            Display unique Jobs from EMP table
2.            List the employees in the ascending order of their salaries
3.            List the details of the employees in ascending order of the dept no and descending of Jobs
4.            Display all the unique job groups in the descending order
5.            Display all the employees who are managers
6.            List the employees who joined before 1981
7.            List the Empno, Ename, Sal, daily sal of all employees in the ascending order of annual sal
8.            Display the Empno, Ename, job, Hiredate, Exp of all Mgrs
9.            List the Empno, Ename, Sal, experience of all employees working for Mgr=7369
10.          Display all the details of the employees whose Comm. Is more than their Sal
11.          List the employees in the asc order of Designations of those joined after the second half of
1981
12.          List the employees along with their experience and daily salary is more than Rs.100
13.          List the employees who are either ‘CLERK’ or ‘ANALYST’ in the Desc order
14.          List the employees who joined on 1-MAY-81,3-DEC-81,17-DEC-81,19-JAN-80 in asc order of
seniority
15.          List the emp who are working for the Deptno 10 or 20

You might also like