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

Project: Faculty of Business and Management

1) The document provides details of a database project to create tables for employees and departments with sample data. 2) It lists the columns and data types for the EMP and DEPT tables along with descriptions and sample data. 3) It provides SQL queries to retrieve specific information from the tables such as names of analysts and salesmen, employees joined before a date, etc.

Uploaded by

wirdina
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Project: Faculty of Business and Management

1) The document provides details of a database project to create tables for employees and departments with sample data. 2) It lists the columns and data types for the EMP and DEPT tables along with descriptions and sample data. 3) It provides SQL queries to retrieve specific information from the tables such as names of analysts and salesmen, employees joined before a date, etc.

Uploaded by

wirdina
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Faculty of Business and Management

Subject Code : BMIS 32113


Subject Name : Database
Programme : BSc. (Hons) MIS
Lecturer : S. Sivaguru
Date : 11 / 03 / 2015
Duration : 1 week

Project

Create the following tables with appropriate constraints and insert the given sample data.

EMP
Column name Data type (Oracle) Description
change to MySQL data type
EMPNO Number Employee number, Primary Key
ENAME Varchar Employee name
JOB Char Designation
MGR Number Managers Emp. number
HIREDATE Date Date of joining
SAL Number Basic Salary
COMM Number Commission
DEPTNO Number Department Number, Foreign Key

DEPT
Column name Data type (Oracle) Description
change to MySQL data type
DEPTNO Number Department number, Primary Key
DNAME Varchar Department name
LOC Varchar Location of department
Data for EMP
7369 Smith Clerk 7902 17/12/80 800 20
7499 Allen Salesman 7698 20/2/81 1600 300 30
7521 Ward Salesman 7698 22/2/81 1250 500 30
7566 Jones Manager 7839 2/4/81 2975 20
7654 Martin Salesman 7698 28/9/81 1250 1400 30
7698 Blake Manager 7839 1/5/81 2850 30
7782 Clark Manager 7839 9/6/81 2450 10
7788 Scott Analyst 7566 9/12/82 3000 20
7839 King President 17/11/81 5000 10
7844 Turner Salesman 7698 8/9/81 1500 0 30
7876 Adams Clerk 7788 12/1/83 1100 20
7900 James Clerk 7698 3/12/81 950 30
7902 Ford Analyst 7566 4/12/81 3000 20
7934 Miller Clerk 7782 23/1/82 1300 10

Data for DEPT table


10 Accounting New York
20 Research Dallas
30 Sales Chicago
40 Operations Boston

Write SQL Code for the following:

a) List the names of analysts and salesmen.

b) List details of employees who have joined before 30 Sep 81.

c) List names of employees who are not managers.

d) List the names of employees whose employee numbers are 7369, 7521, 7839, 7934, 7788.

e) List employee names for those who have joined between 30 June and 31 Dec. 81.

f) List the different designations in the company.

g) List the names of employees who are not eligible for commission.

h) List the employees not assigned to any department.

i) List employees whose names either start or end with S.

j) List names of employees whose names have i as the second character.

k) List the number of employees working with the company.


l) List the maximum, minimum and average salary in the company.

m) List employees not belonging to department 30, 40, or 10.

n) List the total salary, maximum and minimum salary and average salary of the employees
jobwise, for department 20 and display only those rows having an average salary > 1000.

o) List the number of employees and average salary for employees in department 20.

p) List the employee details in the ascending order of their basic salary.

q) List the employee name and hire date in the descending order of the hire date.

r) List the department numbers and number of employees in each department.

s) List the department number and total salary payable in each department.

t) List the jobs and number of employees in each job. The result should be in the descending
order of the number of employees.

u) List the total salary, maximum and minimum salary and average salary of the employees,
for department 20.

v) List the average salary of the employees job wise, for department 20 and display only
those rows having an average salary > 1000.

You might also like