This document outlines tasks for creating stored procedures and triggers in a database of employee information. The stored procedures are meant to: 1) list employee details within a given date range, 2) list employees whose salary is above the department average, 3) list the N highest paid employees, and 4) increase salaries in a given city by 10%. The triggers are meant to: 1) keep department average salaries below $50,000, 2) ensure manager salaries are above subordinates', 3) keep the salary difference between two departments below $10,000, 4) display inserted employee details, and 5) keep the male to female employee ratio within 10%.
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 ratings0% found this document useful (0 votes)
63 views2 pages
Lab 5 - Ex2 - SP
This document outlines tasks for creating stored procedures and triggers in a database of employee information. The stored procedures are meant to: 1) list employee details within a given date range, 2) list employees whose salary is above the department average, 3) list the N highest paid employees, and 4) increase salaries in a given city by 10%. The triggers are meant to: 1) keep department average salaries below $50,000, 2) ensure manager salaries are above subordinates', 3) keep the salary difference between two departments below $10,000, 4) display inserted employee details, and 5) keep the male to female employee ratio within 10%.
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/ 2
LAB 5 – Stored procedures and Triggers
Create database and insert data to store information of employees as following:
I. Write stored procedures to do bellow tasks: (SPs were named SP_[number]) 1. List all information of employees (code, name, entered date, supervisor’s id, supervisor’s name) whose date of birth is from s to f. S and f are date value that were been input parameters. 2. List all employees (code, name, salary) whose salary more than the average salary of the department that they work in. 3. List N employees that have the highest salary. N is the input parameter. 4. Increase 10% for salary of all employees in the city A. A is the input parameter. 5. Delete all no personnel departments. II. Write triggers to ensure: 1. The average salary of each department must be fewer than 50000. 2. The salary of the head of each department must be greater than or equal to salary of all employees in this department. 3. The different between average salary of employees in HCM and HN must fewer than 10000. 4. Create a trigger Insertemployee which will be activated by an insert statement into the NHANVIEN table. The trigger will display the employee's Full Name and the employee's TENPHG which have just been inserted by the insert statement. 5. The different between number of male and female employees must fewer than 10%.