Middle+
Peab olema kirjeldatud raamatukogu mudel. On 3 üksust: "Autor", "Raamat", "Lugeja". Füüsiliselt on ainult üks raamat ja see võib kuuluda ainult ühele lugejale. Tuleb koostada tabelid raamatukoguks, et seda arvesse võtta.
sobes.tech AI
Vastus AI-lt
To describe the library model with entities "Author", "Book", "Reader" and the condition that each book is physically unique and can only be with one reader at a time, the following tables can be used:
- Author
id(PK)name
- Book
id(PK)titleauthor_id(FK to Author.id)reader_id(FK to Reader.id, nullable)
- Reader
id(PK)name
Explanation:
- Each book is linked to an author via
author_id. - The
reader_idfield in the book table indicates which reader currently has the book. If the book is not loaned out, this field will be NULL.
This ensures that each book exists in a single copy and can only be with one reader at a time.