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

SCHOOL OF COMPUTING

GRAPHIC ERA HILL UNIVERSITY, BHIMTAL CAMPUS


2021-22

A
Term-Work
On

Database Management Lab (PBC-401)


Submitted in partial fulfilment of the requirement for the IV semester
B.C.A
By

Arpit Chandra
2071540

Faculty-in-Charge
Dr. Sudhanshu Maurya
Associate Professor
SCHOOL OF COMPUTING
GRAPHIC ERA HILL UNIVERSITY, BHIMTAL CAMPUS
2021-22
STUDENT’S DECLARATION

I, Arpit Chandra, hereby declare the work, which is being presented in the term-work, entitled

“Database Management lab” in partial fulfilment of the requirement for the award of the degree

B.C.A in the session 2021-2022, is an authentic record of my own work carried out under the

supervision of Dr. Sudhanshu Maurya.

The matter embodied in this term-work has not been submitted by me for the award of any other

degree.

Date: ………… ……………….

(Full signature of student)


SCHOOL OF COMPUTING
GRAPHIC ERA HILL UNIVERSITY, BHIMTAL CAMPUS
2021-22

CERTIFICATE

The term-work entitled “Database Management Lab.” being submitted by Arpit Chandra

S/o G. C. Arya enrolment no PV-B2071540 Roll no 2071540 to Graphic Era Hill University

Bhimtal Campus for the award of bonafide work carried out by him. He has worked under

my guidance and supervision and fulfilled the requirement for the submission of report.

(…………………) (……………………)

Faculty-in-Charge (HOD, SOC)


Lab Practical 01
Ques 1: Create the table Employee and insert data as given:

Output:
Ques 2: Create the table DEPT and insert the following values:

Output:
Ques 3: Create the table Client_Mast and insert the given data:

Output:
Ques 4: Create table Product_Mast and insert the following values:

Output:
Ques 5: Create table Salesman_Mast and insert the given values:

Output:
Lab Assignment 02:
Ques 1: Find out all the names of the names of the clients in the client_mast:
Output:

Ques 2: Retrieve all the records from client_mast:


Output:
Ques 3: Retrieve the list of name, address and city of all the clients from
client_mast:
Output:

Ques 4: List all the clients who are staying in Florida from client_mast:
Output:

Ques 5: List the name of employees who have less salary than Rs 3000 from
employee table:
Output:

Ques 6: List the emp name, job and dept no, of everyone whose name fall in
the alphabetic range ‘C’ to ‘L’ from employee table:
Output:
Ques 7: List all the employees with the start of the letter ‘K’ in employee:
Output:

Ques 8: List the name of dept from the dept table which is located in Noida
and Rocky Creek:
Output:

Ques 9: List the emp name from dept ‘D002’ and ‘D003’ from employee:
Output:

Ques 10: List all employees whose name starts with ‘A’ and end with ‘D’
from employee table:
Output:
Ques 11: List all the managers and salesman with salary over 2500 from
employee:
Output:

Ques 12: Display all the employee name in the ascending order:
Output:

Ques 13: Display all the employees in alphabetical order from employee:
Output:
Ques 14: List all employee who were hired during 1999 from employee:
Output:

Ques 15: List all the employees whose commission is more than Rs. 300 from
employee:
Output:
Lab assignment 03:
Ques 1: Change the city of client_no ‘B001’ from ‘Gainesville’ to ‘paul street’
from client_mast:
Output:

Ques 2: Change the bal_due of client_no B005 to Rs 2000 from client_mast:


Output:
Ques 3: Change the name to ‘infospace’ of client_no B004 in client_mast:
Output:

Ques 4: Change the client number B004 to B009 in client_mast:


Output:

Ques 5: Change the city from ‘Jacksonville’ to ‘Huston’ in salesman_mast:


Output:
Ques 6: Change the basic_sal Rs 3000 where basic_sal is less than 2500:
Output:

Ques 7: Change the basic_sal to 3000 where job is ‘clerk’ in employee:


Output:
Ques 8: Change the basic_sal of employee_no from E004 to Rs 3500 from
employee:
Output:

Qus 9: Change the dname to sales from dept table where deptno is D004:
Output:

Ques 10: Change the description of product PR065 to AC in product_mast:


Output:
Ques 11: Change the profit of product_no PR065 to 25% in product_mast:
Output:

Ques 12: Change the quantity of PR065 to 120 in product_mast:


Output:

Ques 13: Change the SP and CP of PR065 to 6250 and 5000 in product_mast:
Output:
Ques 14: Change the units where the product number PR065 to ‘pack of 10’ in
the product_mast table:
Output:

Ques 15: Create a sequence named counter which is incremented by 1 and


starts with 1:
Output:

Ques 16: Create a sequence named counter which is incremented by 5 and


starts by 25:
Lab Assignment – 4
Ques 1: Delete all salesman from salesman_mast whose salaries are
equal to Rs 2000.
Output:

Ques 2: Write a query to undo the above delete query.


Output:

Ques 3: Delete all the product from product_mast where the quantity
available is 100:
Output:

Ques 4: Write a query so that the above query cannot be undone:


Output:

Ques 5: Delete from client_mast where the state venue is ‘Illinois’:


Output:
Ques 6: Delete all from employee where basic_sal is less than 2000:
Output:

Ques 7: Write a query to mark the above two queries such that the
second query is undone:
Output: unable to do.

Ques 8: Delete employee from employee table where basic_sal equal to


3000 and job = ‘Clerk’.
Output:

Ques 9: Delete employee from employee table where job = ‘clerk’ or


‘manager’.
Output:

Ques 10: Delete all records from Dept table.


Output:
Ques 11: Delete all managers and salesman with salary over 1500 from
employee table.
Output:

Ques 12: Delete all the employee name, job and department, no of
everyone whose name fall in the alphabetical range ‘C’ to ‘L’ from
employee table.
Output:

Ques 13: Write a query so the following statement can be achieved ‘Kim
is working as Manager since 15-12-2002’ where employee number is
E0001.
Output:
Ques 14: Rename the table name from Client_mast to T_client_mast.
Output:

Ques 15: Write a query in which the column name should be displayed as
Employee Name from the Employee table.
Output:
Lab assignment – 5
Ques 1: Add a column “Telephone_no” of data type ‘number’ and size =
‘10’ to the employee table.
Output:

Ques 2: Add a column “Country” of data type ‘Char’ and size = ‘15’ to the
client_mast table.
Output:

Ques 3: Increase the size of “description” field from 14 to 16 in


product_mast table.
Output:

Ques 4: Modify the “product_no” key as a primary key from


product_mast table.
Output:
Ques 5: Drop the primary key of client_mast table.
Output:

Ques 6: Define the “Deptno” as not null constraint from dept table.
Output:
Ques 7: Display empno, ename and annula salary of each employee from
employee table with a column name “Annual salary” on the basis of
basic_sal.
Output:

Ques 8: Add two columns “HOD” and “Strength” of datatype varchar2


and size = 15 to the dept table.
Output:

Ques 9: Add check constraint for dept field to the dept table check
deptno from the ‘D001’, ‘D002’ and ‘D003’.
Output:

Ques 10: Create a view as empview from employee table where basic_sal
equal to 3000 and job = ‘Clerk’.
Output:
Ques 11: Drop the above created empview.
Output:

Ques 12: Create an index for client_no on client_mast table.


Output:

Ques 13: Create view as empview from employee table with basic_sal,
empno and ename.
Output:

Ques 14: Create a view as clientview from client_mast with all columns of
table.
Output:

Ques 15: Drop the above created empview view.


Output:
Lab assignment – 6
Ques 1: Select the average salaries of each department where deptno is
either D001 and D002 from employee table.
Output:

Ques 2: Select the name of the lowest paid employee from employee
table.
Output:

Ques 3: Select the highest paid employee from the employee table.
Output:

Ques 4: Display the total number rows in the employee table.


Output:

Ques 5: Display only those jobs where max sal >= 3000 in the employee
table.
Output:
Ques 6: List the names and hiredate of the employees in deptno = D002,
display date formatted as ‘12/03/03’.
Output:

Ques 7: List the name of employees whose hiredate is in the month of


December using substring function.
Output:

Ques 8: Count the number of people in department number D003.


Output:
Ques 9: Produce the following output using employee table:
Employee

Kim (Manager)

Bruce (Analyst)

Output:

Ques 10: Find out the difference between highest and lowest salaries.
Output:

Ques 11: How many months has the manager worked for the company
(Round value).
Output:

Ques 12: Display the top three earners with name and salary in the
company.
Output:
Ques 13: Display the sin and sinH value of 45.
Output:

Ques 14: Display the ASCII value of “ORACLE”.


Output:

Ques 15: Display all job types in smaller case from employee table.
Output:
Lab Assignment – 7
Ques 1: Select those clients whose bal_due is greater than value 2000 from
client_mast.
Output:

Ques 2: Count the total number of orders from product_mast table.


Output:

Ques 3: Calculate the average price of all the products from product_mast table.
Output:
Ques 4: Calculate the maximum and minimum product prices and rename the
output as max_price and min_price respectively from product_mast table.
Output:

Ques 5: Count the number of products having price greater than or equal to
1200.
Output:

Ques 6: Display the employee number and day on which employee hired from
employee table.
Output:

Ques 7: Display the total number of working days of each employee from
employee table.
Output:
Don’t know how to do it (googled it too)
Ques 8: Display the date, 20 days after today’s date.
Output:

Ques 9: Count all distinct job types from employee table.


Output:

Ques 10: Using LPAD function pad the job types with 15 characters by ‘*’
symbol.
Output:

Ques 11: Display the length of each employee name from employee table.
Output:
Ques 12: Display the value of 3 raised to 4 using power function.
Output:

Ques 13: Display the square root of 81.


Output:

Ques 14: Display the number of bytes used by ename from employee table.
Output:

Ques 15: Display the ename those are having sound like Kim from employee
table.
Output:
Lab Assignment – 8
Ques 1: Select the average salaries of each department where dept_no is either
D001 or D002.
Output:

Ques 2: Find Average salary per job in each department_no.


Output:

Ques 3: Find avg, min, max salaries of employee from each dept_no.
Output:

Ques 4: Display the dept_no where more than two clerks are working.
Output:
Ques 5: Who was the first employee hired in each department_no.
Output:
Don’t know how to do.
Ques 6: Display the average month salary bill for each job type within a
dept_no.
Output:

Ques 7: Find all departments which have more than 3 employees.


Output:

Ques 8: Display only those jobs where max sal >= 3000.
Output:
Ques 9: Find out the employees who earn the highest salary in each dept_no.
Output:
Can’t do it
Ques 10: Display the employees who are doing the same job as ‘KIM’.
Output:

Ques 13: List names of employees who do not work in the marketing
department.
Output:
Lab Assignment – 9
Ques 1: Create the tables described below:
a- Table Name: Client_mast

b- Table Name: Product_mast

c- Table Name: salesman_mast

d- Table Name: sales_order

e- Table Name: sales_order_detail


Ques 2: Insert the following data into their respective tables:
a- Client_mast

b- Product_mast
c- Salesman_mast

d- sales_order
e- sales_order_detail

Ques 3: List the name of employees who do not work in the D001 department
from employee table.
Output:

Ques 4: Find the profit value of each product sold from product_mast table.
Output:

Ques 5: Find the products and their quantities that will have profit price greater
than 10 from product_mast table.
Output:

You might also like