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

Mysql Procedure and Function Assignmnet

Uploaded by

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

Mysql Procedure and Function Assignmnet

Uploaded by

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

stored procedure

1)Create a procedure for adding a row in emp table. Display number of rows added.
Handle corresponding exception

2)Create a procedure which takes employee number as parameter and delete the
employee record. Procedure must return the empname whose record has be deleted.

3)Create a procedure which takes department name as paramater and displays all the
employee records, no of employee in that department.

4)Create a procedure which takes empno as IN parameter and gives


OUT entire record of the employee

5)create a prcedure which would accept 2 dates as arguments and returns


difference between them in years and months Eg: "3 years 6 months"

6) Create table with following structures

- emp_bonus(empno,ename,annual_salary,bonus)

- using cursor program fetch empno,ename,sal,comm from emp table.


- for each record fetched find annual salary which includes comm
- compute various percentage of bonus based on annual salary.
- insert empno,ename,annual_salary,bonus into emp_bonus table
- display number of rows inserted.

7)Design a cursor program in which you select empno,ename,job,sal


into a collection and display the same for any department number passed as argument
to cursor.

8)Write a procedure to create a cursor displays the name and salary of each
employee in the EMPLOYEES table whose salary is less than that specified by a
passed-in parameter value.

9)Write a procedure to display employee id, name, hire date, and the incentive
amount they achieved according to their working experiences,

10)Write procedure to display the department with more than five employees.

stored functions

1)Create a function which takes department name as paramater and


return the no of employee working in that department.

2)Write function to return the department no having more than five employees

3)write a function to return the employee who is earning second max salary from a
perticular department.

4)write a function to return the employee who is having maximum experience from the
emp table.

You might also like