Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write the SQL statement accroding to the below questions: added a column named as fine (numeric) in the transaction table. This is for storing the

write the SQL statement accroding to the below questions:

added a column named as fine (numeric) in the transaction table. This is for storing the amount of fine paid by the patron when a book is returned late.

Q1: Create a Procedure issueBook, where patron_id and book_id is taken as parameters.

issueBook(patron_id, book_id)

This function will run when the patron is coming to issue a book.

Steps:

Verify the patron_id in the patron table

Verify the book_id in the book table (not a reference book)

Insert the new row in transaction tale with

-patronid, book id, transactiondate as today, fine 0 and rating as 1.

The transaction_id should automatically generate using sequence

q2: Create another procedure returnBook(patron-Id, book_id)

Create a procedure that should take in patron_id and book_id as parameters. The procedure will calculate the amount of fine due on the book.

This procedure will run when the patron is coming back to return the book.

Steps:

Read the tuple with the patron_id and book_id with type=1. Check the transaction date. Add 7 to that. If todays date > calculated date, calculate the fine.

Now insert the new row in transaction tale with

-patronid, book id, transactiondate as today, fine as calculated and rating as 2.

The transaction_id should automatically generate using sequence.

q3: Convert returnBook into a function that will return the fine amount.

Q4: Create a procedure to display the details of all the books that have been issues in the month of February.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What is the preferred personality?

Answered: 1 week ago

Question

What is the relationship between humans?

Answered: 1 week ago