You are on page 1of 2

CSE250 Database Management System

Assignment-3
Submission Date : April 3, 2022 (will not be extended)

1. Write a procedure to input any number. Check whether it is prime or not. If it is not prime, display
its factors.
2. An insurance company follows the following rules to calculate premium.
a. If a person’s health is excellent and the person is between 25 and 35 years of age and lives
in a city and is a male then the premium is Rs. 4 per thousand.
b. If a person satisfies all the above conditions except that the gender is female then the
premium is Rs. 3 per thousand.
c. If a person’s health is poor and the person is between 25 and 35 years of age and lives in
a village and is a male then the premium is Rs. 6 per thousand.
d. In all other cases the person is not insured.
Write a procedure to input person’s health, age, city and gender; and display the premium as per
the rules given above.
3. A company makes three products which are codified as class A, class B and class C. On class A
items for purchase above Rs. 5000, 10% discount is given. For class B for purchase above
Rs. 8000, a discount of 5% is given. On class C on a purchase of Rs. 10000 and above, 4%
discount is given. Write a procedure to input product’s class and purchase amount and display
discount along with the payable amount.
4. Write a procedure to input marks of three subjects. Assume that marks of each subject is
obtained out of 50. Calculate percentage. From the following table, check percentage range and
according to that display the grade.
Percentage Grade
>=0 and <35 F
>=35 and <50 D
>=50 and <65 C
>=65 and <80 B
>=80 A
5. Write a function to input basic_salary of the employee and return net_salary by applying the
following formulas.
DA=43% of basic_salary
HRA=15% of (basic_salary+DA)
MA=100.00
CLA=240.00
TA=800.00
PF=12% of (basic_salary+DA)
IT=10% of basic_salary
PT : if basic_salary>=0 and <2000 then PT=20.00
if basic_salary>=2000 and <4000 then PT=40.00
if basic_salary>=4000 and <6000 then PT=60.00
if basic_salary>=6000 then PT=100.00
Allowances=DA+HRA+MA+CLA+TA
Deductions=PF+IT+PT
Net_salary=basic_salary+allowances-deductions
6. Write a function to input person’s age as total no. of days and return age of that person in years,
months and days. (For ex., if user inputs 3456 then the age should be displayed as 9 years, 5
months and 5 days. Hint: First divide no. with 365 to get years. The quotient will be no. of years
and reminder should be further divided by 30 to get months. When reminder is divided with 30,
the quotient will be no. of months and reminder will be no. of days )
7. A computer manufacturing company has the following monthly compensation policy for their
salespersons.
Basic Salary : 10000.00
Bonus for every computer sold : 500.00
Commission on the total monthly sales : 2%
Write a procedure to input price of one computer and total no. of computers sold by the
salesperson. Calculate and display total bonus, total commission and gross salary.
8. Create a table PERSON with fields first_name, middle_name, last_name, age and gender.
Person(first_name,middle_name,last_name,age,gender)
Write procedure that will retrieve records from the PERSON table and will display person’s
name as following four formats. For Ex., if first name is Pooja, middle name is Harshad and last
name is Shah then it should be displayed as follows.
Pooja Harshad Shah P. H. Shah Shah P.H. Shah Pooja Harshad
9. Write a procedure that will read records from the PERSON table. Display all the names given in
the PERSON table as per the conditions given below. For ex., if first name=Hemal, middle
name= Harshad, last name=Shah,
a. If gender=female and age >12 then display it as Ms. Hemal Harshad Shah
b. If gender=female and age<=12 then display it as Baby Hemal Harshad Shah
c. If gender=male and age<=12 then display it as Master Hemal Harshad Shah
d. If gender=male and age>12 then display it as Mr. Hemal Harshad Shah
10. Write a procedure to display the details of STUDENT and CLASS table.
Class(classcode,classdesc)
Student(stdno,classcode,stdname,birthdate,admissiondate,gender,contact)
11. Create a procedure to display employee name, salary and joining date from the EMPLOYEE
table. Also, display total no. of years of experience of each employee from the joining_date field
and retirement date of each employee from the birth_date field.
12. Create a procedure which will display department wise employee details in ascending order of
department name and descending order of employee names within the department.
Department(deptno, deptname)
Employee(empno, deptno, empname, salary, birth_date, joining_date)
13. Write a pl/sql block to update salary of employees as per the rules given below.
If total no. of years of experience is below 5 years, increase the salary by 5%
If total no. of years of experience is between 5 and 10 years, increase the salary by 8%,
If total no. of years of experience is between 10 and 15, increase the salary by 10%,
In all other cases, increase the salary by 13%
14. Create a function which will take student name as a parameter and will return name of the subject
in which he/she got highest marks. Use this table : Student(Id, name, DBMS_marks, DM_marks,
DS_marks, FOP_marks, OOP_marks)
15. Create a procedure to display names of each student and the subject in which he/she has obtained
highest marks along with the marks. Use this table : Student(Id, name, DBMS_marks,
DM_marks, DS_marks, FOP_marks, OOP_marks)

*****

You might also like