0% found this document useful (0 votes)
92 views

SQL Assignment 1

This document describes the structure and sample data for EMP and DEPT tables. The EMP table contains information about employees including employee number, name, job, manager, hire date, salary, commission, and department number. The DEPT table contains the department number, name, and location. The document then provides sample data for the EMP and DEPT tables and 16 queries to retrieve information from the tables.

Uploaded by

Aman Jaiswal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

SQL Assignment 1

This document describes the structure and sample data for EMP and DEPT tables. The EMP table contains information about employees including employee number, name, job, manager, hire date, salary, commission, and department number. The DEPT table contains the department number, name, and location. The document then provides sample data for the EMP and DEPT tables and 16 queries to retrieve information from the tables.

Uploaded by

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

Following are the structure of the tables

EMP TABLE

NAME NULL TYPE


EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO Number(2)

DEPT TABLE

NAME NULL? TYPE


DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)

Following are the Data of Tables

EMP TABLE

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO


7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7839 09-DEC-82 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10

DEPT TABLE

DEPTNO DNAME LOC


10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON

SOLVE the following QUERIES, which are based on the EMP and DEPT tables.

1) List all the information about employees in the EMP table.


2) List all the information about department in the DEPT table.
3) List the employee number, name, job title and hired date of employees in department 10.
4) Select name and salary of employees who are clerks.
5) List the department number and name for all departments with department numbers greater than or equal to
20.
6) List the name of the employees having salary less than 2500.
7) Select name, salary and commission of employees whose commission is greater than their salary.
8) List the employee number and name of the President.
9) List the employees who do not get commission.
10) List all the employees in department number 10 other than KING.
11) Display names of the employees whose job is either ANALYST or CLERK.
12) Display different kinds of jobs available.
13) List names of all the employees whose names are 4 characters long.
14) List names of all employees whose names end with letter ‘R’.
15) List names of all employees whose names start with ‘B’ or ‘M’.
16) Select all employees whose names fall between ‘A’ and ‘G’ alphabetical range.

You might also like