Professional Documents
Culture Documents
CMS: 356324
Submitted to: Waqas Ahmed
25-12-2020
DATABASE SYSTEMS
LAB-8
TASKS
Task-1: Write a procedure to add an amount of Rs.1000 for the employees
whose salaries is greater than 5000 and who belongs to the deptno
passed as an argument
STEPS
First we CREATE a PROCEDURE “add_salary” that accepts integer type dep
The we update the salary whose salary is more than 5000 by using UPDATE clause
Then we call the function using CALL
Calling the function, updates the value
then select the names of employees of the department by using the SELECT clause
Task-2: Write a MySQL block to update the salary of the employee with a 10%
increase whose empno is to be passed as an argument for the procedure.
STEPS
First we CREATE a PROCEDURE “upd_salary” that accepts integer type emplno
The we update the salary whose salary by 10% whose employee id is given by using
UPDATE clause
Then we call the function using CALL
Calling the function, updates the value
then select the names of employees of the department by using the SELECT clause
Task-3 Write a function to find the salary of the employee who is working in
the deptno 20 (to be passed as an argument).
STEPS
First we CREATE a FUNCTION “dep_salary” that accepts integer type dep and
RETURNS integer type
The we return the salary by using RETURN clause
Then we call the function using SELECT
Task-4: Write a function to find the nature of job of the employee whose
deptno is 20(to be passed as an argument)
STEPS
First we CREATE a FUNCTION “JOB_NATURE” that accepts integer type dep and
RETURNS varchar type
The we return the salary by using RETURN clause
Then we call the function using SELECT
Task-5: Write a MySQL block to obtain the department
name of the employee who works for deptno 10
STEPS
First we CREATE a PROCEDURE “upd_salary” that accepts integer type emplno
then select the names of employees of the department by using the SELECT clause
Then we call the function using CALL
Calling the function, displays the value
=====================================================================================
THANK YOU