ICT501 Exercise 6 Joins New

You might also like

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

UNIVERSITI TEKNOLOGI MARA

KAMPUS SEREMBAN

CAWANGAN NEGERI SEMBILAN

FACULTY OF COMPUTER AND MATHEMATICAL SCIENCES (FSKM)

ICT501

DATABASE MANAGEMENT SYSTEM

TITLE:

Exercise 6 (joins)

NAME STUDENT ID
NUR HAZIERA BINTI BAHAR 2019608162
NUR NAJIHAH BINTI HASAN 2019695876
SITI NOR SYUHADA BINTI BAHREN 2019726063
SITI NUR AFIFAHALIN BINTI MOHD JAINUDDIN 2019853948

PROGRAMME: CS241 – BACHELOR OF SCIENCE (HONS) STATISTICS

CLASS: N4CS2413T2

PREPARED FOR: SIR SHAMSUDIN MD SARIF

SUBMISSION DATE: 27/11/2019


Exercise 6: Joins

1. Display all employee names and their department name, in department name order.

2. Display all employee names, department number and name.


3. Display the name, location and department of employees whose salary is more than 1500 a
month.

4. Produce a list showing employees' salary grades.

SELECT E.ENAME, E.JOB, E.SAL, S.GRADE


FROM EMP E, SALGRADE S
WHERE E.EMPNO = D.EMPNO

5. Show only employees on Grade 3.

SELECT *
FROM EMP E JOIN SALGRADE S
ON E.EMPNO = S.EMPNO
WHERE S.GRADE = 3;

6. Show all employees in Dallas.

7. List the employee name, job, salary, grade and department name for everyone in the company
except clerks. Sort on salary, displaying the highest salary first.
8. List ename, job, annual salary, deptno, dname, and grade for employees who earn $36000 a
year or who are clerks.

9. Display the following information.

EMPNO ENAME DNAME LOC


---------- -------- ---------- ---------------
7782 CALRK ACCOUNTING NEW YORK
7934 MILLER ACCOUNTING NEW YORK
7839 KING ACCOUNTING NEW YORK
7369 SMITH RESEARCH DALLAS
7788 SCOTT RESEARCH DALLAS
7566 JONES RESEARCH DALLAS
7876 ADAMS RESEARCH DALLAS
7902 FORD RESEARCH DALLAS
7499 ALLEN SALES CHICAGO
7698 BLAKE SALES CHICAGO
7844 TURNER SALES CHICAGO
7900 JAMES SALES CHICAGO
7654 MARTIN SALES CHICAGO
7521 WARD SALES CHICAGO
14 records selected
10. Display the department that has no employees.

11. List all employees by name and number along with their manager's name and number.

12. Modify solution to question 2 to display KING who has no manager.

13. Find the Job that was filled in the first half of 1983, and the same Job that was filled during the
same period in 1984.
14. Find all employees who joined the company before their manager.

You might also like