EMP Table Structure:: Name Null? Type

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ASSIGNMENT 2

EMP Table Structure:

Name Null? Type


------------------------------- -------- ----------------------
EMPNO NOT NULL NUMBER (4), Primary Key
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4), may/may not any EMPNO
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2) foreign key of DEPT table

Records in EMP table:

ENO ENAME JOB MGR HIREDATE SAL COMM DEPTNO


7369 Smith Clerk 7902 17-Dec-88 1000 20
7499 Allen Salesman 7698 20-Feb-89 1600 300 30
7521 Ward Salesman 7698 22-Feb-89 1250 500 30
7566 Jones Manager 7839 02-Apr-89 2975 20
7654 Marti Salesman 7698 28-Sep-89 1250 1400 30
7698 Blake Manager 7839 01-May-89 2850 30
7782 Clark Manager 7839 09-Jun-89 2450 10
7788 Wong Analyst 7566 19-Apr-87 3000 20
7839 King President 17-Nov-89 5000 10
7844 Turn Salesman 7698 08-Sep-89 1500 0 30
7876 Adam Clerk 7788 23-May-87 1100 20
7900 James Clerk 7698 03-Dec-89 950 30
7902 Ford Analyst 7566 03-Dec-89 3000 20
7934 Mille Clerk 7782 23-Jan-86 1300 10
DEPT Table Structure:

Name Null? Type


------------------------------- -------- ----
DEPTNO NOT NULL NUMBER(2), Primary key
DNAME VARCHAR2(14)
LOC VARCHAR2(13)

DEPT table:

DNO DNAME LOC


10 HRD Houston
20 RESEARCH Dallas
30 SALES Chicago
40 OPERATION Boston
Queries

1. Display the name, deptno, dname for all employees.


2. Create a unique listing of all jobs that are in deptno 30. Include the location
of dept 30 in the output.
3. Display the employee name, dept name and the location of all employees
who earn a commission.
4. Display the employee name, dept name for all employees who have an ‘A’ in
their name.
5. Display the employee name, job, deptno, dept name for all employees who
work in DALLAS.
6. Display the employee name, empno along with their manager’s name and
manager no.
7. Modify query 6 to display all employees including king, who has no
manager.
8. Display the employee name of all the employees that work in the same
deptno as a given employee.
9. Find the name of all employees who work in same department as do their
manager
10.Display the employee name, and hire date of any employee hired after
BLAKE.
11.Display the employee name, and hire date along with their manager’s name
and hire date of all employees hired before their manager.
12.Find the second highest salary from emp table.

You might also like