Question:
In a library mgmt. system how many tables would i need in the database?
anonymous
2014-07-10 06:19:29 UTC
one table for student records. one table for books records. How will i issue the books to students? will i need more tables?
Three answers:
raina_vissora
2014-07-10 06:42:33 UTC
You need as many tables as required to store the necessary data. How many tables that ends up being is going to depend on your design criteria.



As you said, you'll need a table to keep track of students, and one to keep track of books. You'll also need a table to keep track of check-outs (and depending on how you set it up, a table to keep track of which student record is associated with which check-out).



You could further break things down and add a table for authors containing additional info about the authors themselves. You could have a table of metadata that extends the books table. You could have a table for reserved books (so that if a book is checked out, a student can reserve it).



Your question is entirely subjective. It depends on how complex or simple you want to make the system.



Technically speaking, you could do it all in one table if you wanted to. It wouldn't be very efficient or flexible, and god help you if you ever needed to add new features, but it would technically work.



Likewise, you could do it with 5 tables or 10 tables or 50 tables, depending on your design.
Chris
2014-07-10 07:02:00 UTC
The simplest answer: you need one more table with two columns that connects student id to book id.

Each row of that table is one checked out book.

When they check out a book, you add a row with studentID and bookID.

When they return it, you delete the row.
Paultech
2014-07-10 06:22:17 UTC
well you just need a extra column on the book records for the student who has borrowed the book, and possible record the date when it was borrowed and due back


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...