Assignmen1 RDBMS
Assignmen1 RDBMS
Practical Assignment
Create DEPT and EMP with the following structures with appropriate
constraints.
dept(deptno,dname,location)
emp(empno,ename,job,mgrno,hiredate,sal,comm,deptno)
Constraints on tables :
Primary key : dept(deptno)
Primary key : emp(empno)
Foreign key : emp(deptno) (referential integrity)
(1) List all information about the employees in the EMP table.
(2) List all information about the departments in DEPT TABLE.
(3) List the employee number, name, job title, hire date of employees in
department 10.
(4) Select the name and salary of all employees who are clerks.
(5) List the name, job title and salary of everyone hired in year 1993.
(6) List the department number and name for departments with numbers
greater than or equal to 20.
(7) List the names of employees whose salaries are less than 3000.
(8) Select the name, salary and commission of employees whose commission
is greater than their salary.
(9) List the names and employee numbers of managers who earn more than
5000. Display in alphabetic order by name.
(10) Select information about managers and the president from the table EMP.
Order the result by department number.
(11) List the employees names that do not end in S.
(12) List the name, job and department of everyone whose name falls in the
alphabetic range “C” to “E”.
(13) List employee details working in department 20,30,40
(14) List of employees whose names start with T and ends with R.
(15) List of employees who do not get any commission.
(16) List the names and hire dates of the employees in department 20. Display
the hire date formatted as ‘12/05/93’.
(17) How many months has the president worked for the company ? Round to
the nearest whole number of months.
(18) List the names of employees whose hiredate is in the month of December.
(19) Display the name, monthly salary, yearly salary for all employees.
(20) Retrieve the analyst record with the hiredate formatted as the 3rd of
December, 2008.
(21) List the names of the employees whose hiredate is in the month of
December and year 1981 .
(22) List all employees names , jobs and a job classification.
Job classification : 1 for clerk, 2 for manager, ........
(23) Give SQL command to find the average annual salary per job in each
department.
(24) In on query, count the number of people in department 30 who receive
a salary and the number of people who receive a commission.
(25) Compute the average, minimum, maximum salaries of those group of
employees having the job of clerk or manager.
(26) Display the department number of departments which have more than one
clerk.
(27) Calculate the total compensation expense for each department for one
year.
(28) What is the length of the longest employee name?
(29) Which employees earns less than 30% of the president's salary?
(30) List the employees whose names are the longest.
(31) Who was the last employee hired in each department.
(32) How many employees work in New York?
(33) Which employees work in New York?
(34) List the employees names and cities in which they work, order the list by
city
(35) Find the number of different employees and number of departments.
(36) Determine the average salaries of employees.
(37) Find all employees working in department 10 other than king.
(38) List department number, department name, location and total commission
paid and total salary of each departments