Hi Guys,
I am creating a Library Management system. I've got the basic tables like members, books etc. I'm wondering how I should handle borrowing and returning of books. Should I use one table or two? Please advise.
Hi Guys,
I am creating a Library Management system. I've got the basic tables like members, books etc. I'm wondering how I should handle borrowing and returning of books. Should I use one table or two? Please advise.
I would say two tables.
1.) to maintain transactions with fields, BookId, MemberId, BorrowedDate, ReturnDate, IsCheckedOut (or IsBorrowed, whatever makes sense).
2.) To maintain active check outs. This table will have a row inserted every time there is an insert in transactions table above and a delete every time there's an update to the table above (to set IsCheckedOut to false).
I would disagree with the second table, that's a denormalisation and just means you have to maintain checked out books in two places instead of one.
Instead you just need the transactions table with BookID, MemberID, CheckedOutDate and CheckedInDate.
To see checked out books you just look for transactions with a checked out date but no checked in date.
When one of my minions says, "Hey, he's just one guy, what can he do?" I say "This"... and shoot them.
The problem with putting your lair in a volcano is keeping your robot army from melting.
I know that the human being and the fish can coexist peacefully - George Bush
a table for books, a table for borrowers, and one table for check outs & ins..... the checkout table would have an ID, the book ID, the borrower id, the checkout date, and a due date... the check-in date would be left null, until the book is checked in.
-tg
* I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
*Proof positive that searching the forums does work: View Thread *
* How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
* How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
* Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
"There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
Thanks guys. Will go with tg's answer![]()
hey techgnome,
I'm using the table for borrowers as you suggested. I need to be able to reserve a book as well if it is out. How should I handle this?a table for books, a table for borrowers, and one table for check outs & ins..... the checkout table would have an ID, the book ID, the borrower id, the checkout date, and a due date... the check-in date would be left null, until the book is checked in.
Expand the check out table ... add a Reserved field, then when a book is reserved... set the flag, and don't set a checkout date...
-tg
* I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
*Proof positive that searching the forums does work: View Thread *
* How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
* How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
* Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
"There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
thanks techgnome