0% found this document useful (0 votes)
111 views3 pages

Assignment - 8

The document provides instructions to create tables for a database including LOCATION, DEPARTMENT, JOB, and EMPLOYEE tables. It includes the column names and constraints for each table. Sample data is provided to insert into each table. Finally, 24 queries are listed to perform on the tables including listing employees by department, salary range, name, order by various columns, and aggregating statistics by department.

Uploaded by

JAYPALSINH GOHIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views3 pages

Assignment - 8

The document provides instructions to create tables for a database including LOCATION, DEPARTMENT, JOB, and EMPLOYEE tables. It includes the column names and constraints for each table. Sample data is provided to insert into each table. Finally, 24 queries are listed to perform on the tables including listing employees by department, salary range, name, order by various columns, and aggregating statistics by department.

Uploaded by

JAYPALSINH GOHIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

M.U. B.C.A.

05BC1204 – DBMS - 1
Semester - II * ASSIGNMENT – 8 *

ASSIGNMENT - 8

 Create the Following Tables:



1. Create LOCATION Table with columns Location_Id, Regional_Group.

Constraints on LOCATION table: Location_Id Primary Key.

2. Insert the following records into the table LOCATION:


LOCATION_ID REGIONAL_GROUP
------------- ------------------------------
122 NEW YORK
123 DALLAS
124 CHICAGO
167 BOSTON
3. Create DEPARTMENT Table with columns Department_Id, Name,
Location_ID.

Constraints on DEPARTMENT table: Department_Id Primary Key, Location_Id


references LOCATION table.

4. Insert the following records into DEPARTMENT table:


DEPRATMEMT_ID NAME LOCATION_ID
------------------------ --------------------- ---------------------
10 ACCOUNTING 122
20 RESEARCH 124
30 SALES 123
40 OPERATIONS 167

5. Create JOB Table with columns Job_Id, Funcation.

Constraints on JOB table: Job_ID Primary Key.

6. Insert the following records into JOB table:


JOB_ID FUNCTION
------------------ -------------------
667 CLERK
668 STAFF
669 ANALYST
670 SALESPERSON
671 MANAGER
672 PRESIDENT

Compiled and Prepared By: Dr. Jaypalsinh A. Gohil & Prof. Amit M. Gohel -1-
M.U. B.C.A. 05BC1204 – DBMS - 1
Semester - II * ASSIGNMENT – 8 *

7. Create EMPLOYEE Table with columns Employee_Id, Last_Name, First_Name,


Middle_Name, Job_Id, Manager_Id, Hire_Date, Salary, Comm, Department_ID.

Constraints on EMPLOYEE table: Employee_Id Primary Key, Last_Name


NotNull, Department_Id references DEPARTMENT table.

8. Insert the following records into EMPLOYEE table:

MID
EMPL MAN DEPA
LAST_N FIRST_N DLE JOB_ HIRE_DA SALA COM
OYEE AGE RTME
AME AME _NA ID TE RY M
_ID R_ID NT_ID
ME
--------
------- ------- ----- ----- ------- ------- ------ --- ------
-
7369 SMITH JOHN Q 667 7902 17-DEC-84 800 NULL 20
7499 ALLEN KEVIN J 670 7698 20-FEB-85 1600 300 30
7505 DOYLE JEAN K 671 7839 04-APR-85 2850 NULL 30
15-MAY-
7506 DENNIS LYNN S 671 7839 2750 NULL 30
85
7507 BAKER LESLIE D 671 7839 10-JUN-85 2200 NULL 40
CYNTHI
7521 WARK D 670 7698 22-FEB-85 1250 500 30
A

 Perform the following queries on the above given table:


1. List all job details.
2. List all the locations.
3. List out first name,last_name,salary, commission for all employees.
4. List out employee_id,last_name,department_id for all employees and
rename employee_id as “ID of the employee”, last_name as “Name of the
employee”, department_id as “department ID”.
5. List out the employee’s annual salary with their names only.
6. List out the employees who are working in department 20.
7. List out the employees who are earning salary between 3000 and 4500.
8. List out the employees who are working in department 10 or 20.
9. List out the employees whose name starts with “S”.
10. List out the employees whose name length is 4 and start with “S”
11. List out the employee id, last name in ascending order based on the employee id.

Compiled and Prepared By: Dr. Jaypalsinh A. Gohil & Prof. Amit M. Gohel -2-
M.U. B.C.A. 05BC1204 – DBMS - 1
Semester - II * ASSIGNMENT – 8 *

12. List out the employee id, name in descending order based on salary column.
13. List out the employee details according to their last_name in ascending order and
salaries in descending order.
14. List out the employee details according to their last_name in ascending order and
then on department_id in descending order.
15. How many employees who are working in different departments wise in the
organization.
16. List out the department wise maximum salary, minimum salary, average salary of
the employees.
17. List out the department id having at least four employees.
18. How many employees in January month.
19. Display the employee who got the maximum salary.
20. Display the employees who are working in Sales department.
21. Display the employees who are working as “Clerk”.
22. Find out no. of employees working in “Sales” department.
23. List our employees with their department names.
24. Display employees with their designations (jobs).

Compiled and Prepared By: Dr. Jaypalsinh A. Gohil & Prof. Amit M. Gohel -3-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy