0% found this document useful (0 votes)
12 views2 pages

DBMS Practical 4

Uploaded by

janhaviraikar007
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
12 views2 pages

DBMS Practical 4

Uploaded by

janhaviraikar007
Copyright
© © All Rights Reserved
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

Zeal College of Engineering and Research

Subject: Database Management System Lab

Name: Janhavi Rahul Raikar


Roll No: T213011
Div: C
Batch: C1
Group A: Practical No. 4

PROBLEM STATEMENT:
Consider Tables:
1. Borrower(Roll_no, Name, Date of Issue, Name of Book, Status)
2. Fine(Roll_no, Date, Amt)
• Accept Roll_no and Name of Book from user.
• Check the number of days (from date of issue).
• If days are between 15 to 30 then fine amount will be Rs 5per day.
• If no. of days>30, per day fine will be Rs 50 per day and for days less than 30, Rs. 5
per day

CODE:

create table borrower(rollno int,bname varchar(20), dateofissue date, status varchar(10));


insert into borrower values(1,'maths',2024-08-20,'i');
insert into borrower values(2,'maths','2024-08-01','i');
insert into borrower values(3,'marathi','2024-09-1','i');
create table fine(rollno int, bname varchar(20), fine float);

Delimiter //
create procedure efine(IN rollno1 int, IN bname1 varchar(20))
begin
declare fine float;
declare days int;
declare idate date;
select dateofissue into idate from borrower where rollno=rollno1 and bname =
bname1;
select datediff(curdate(),idate) into days;
if days>15 and days<=30 then
set fine=(days-15)*5;
insert into fine values(rollno1,bname1,fine);
elseif days>30 then
set fine = (days-30)*50 + 15*5;
insert into fine values(rollno1,bname1,fine);
end if;
update borrower set status = ‘r’ where rollno=rollno1 and bname=bname1;
end //

delimiter ;
call afine(1,’maths’);
call afine(2,’english’);
call afine(3,’marathi’);
OUTPUT:

You might also like