|
-
Jul 24th, 2012, 06:41 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Library Management System
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.
-
Jul 24th, 2012, 09:32 AM
#2
Fanatic Member
Re: Library Management System
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).
-
Jul 24th, 2012, 09:58 AM
#3
Re: Library Management System
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.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Jul 24th, 2012, 10:32 AM
#4
Fanatic Member
Re: Library Management System
 Originally Posted by FunkyDexter
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.
Right. For a moment I guess I forgot about views.
-
Jul 24th, 2012, 10:52 AM
#5
Re: Library Management System
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
-
Jul 25th, 2012, 05:25 AM
#6
Thread Starter
PowerPoster
Re: Library Management System
Thanks guys. Will go with tg's answer
-
Sep 11th, 2012, 06:39 AM
#7
Thread Starter
PowerPoster
Re: Library Management System
hey techgnome,
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.
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?
-
Sep 11th, 2012, 08:25 AM
#8
Re: [RESOLVED] Library Management System
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
-
Sep 12th, 2012, 03:24 AM
#9
Thread Starter
PowerPoster
Re: [RESOLVED] Library Management System
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|