Task: Database Design for a Library Management System
Imagine you are working with a busy public library that wants to improve the way it keeps track of books, members, and activities. The librarians and staff have described their needs, but they do not know how to structure a database. Your task is to design a relational database that fulfills these requirements.
The library has thousands of books, each with a title, author, publication year, and a unique code.
People can register as library members. They need to provide their name, contact information, and date of birth. Members can borrow multiple books at the same time and may return them on different dates.
The staff wants to track which member has borrowed which book, when it was borrowed, and when it was returned. They also want to know if a book is currently available or already checked out.
Occasionally, the library organizes events like book clubs, author talks, or reading competitions. Each event has a name, date, location, and a list of participating members. The staff wants to track who attends each event.
Some members leave comments or ratings on books they have read. The library wants to keep a record of these reviews, including who wrote them and when.
The system should also allow staff to manage late fees, if a member returns a book after the due date, and keep track of how much each member owes.
Your task is to design a database structure that supports all of these activities. Decide how to organize the information, how many tables are needed, and what relationships should exist between them.
Kirjastossa on tuhansia kirjoja, joista jokaisella on nimi, tekijä, julkaisuvuosi ja yksilöllinen tunnus.
Ihmiset voivat rekisteröityä kirjaston jäseniksi. Heidän tulee antaa nimensä, yhteystietonsa ja syntymäaikansa. Jäsenet voivat lainata useita kirjoja samanaikaisesti ja palauttaa ne eri ajankohtina.
Henkilökunta haluaa seurata, mikä jäsen on lainannut minkäkin kirjan, milloin laina on alkanut ja milloin kirja on palautettu. Lisäksi halutaan tietää, onko kirja tällä hetkellä saatavilla vai jo lainassa.
Ajoittain kirjasto järjestää tapahtumia, kuten lukupiirejä, kirjailijavierailuja tai lukukilpailuja. Jokaisella tapahtumalla on nimi, päivämäärä, sijainti ja lista osallistuvista jäsenistä. Henkilökunta haluaa seurata, ketkä osallistuvat kuhunkin tapahtumaan.
Osa jäsenistä jättää lukemistaan kirjoista kommentteja tai arvioita. Kirjasto haluaa säilyttää tiedot näistä arvosteluista, mukaan lukien kuka ne on kirjoittanut ja milloin.
Järjestelmän tulee myös mahdollistaa myöhästymismaksujen hallinta, jos jäsen palauttaa kirjan eräpäivän jälkeen, sekä seurata, kuinka paljon kukin jäsen on velkaa.
Tehtäväsi on suunnitella tietokantarakenne, joka tukee kaikkia näitä toimintoja. Päätä, miten tiedot järjestetään, kuinka monta taulua tarvitaan ja millaisia suhteita taulujen välillä tulee olla.
Design Steps