The time has come to design a full-fledged shelf on your own, combining everything you have learned in the scriptorium. We will build the heart of the lending desk - the wypozyczenia (loans) table, which links books with readers.
Each loan is one row. We must record:
id INT AUTO_INCREMENT PRIMARY KEY. It is a pattern you already know.ksiazka_id, czytelnik_id and data_wypozyczenia must always have a value, so we add NOT NULL.data_zwrotu without NOT NULL, because while the book is on loan it stays empty (NULL).1CREATE TABLE wypozyczenia (
2 id INT AUTO_INCREMENT PRIMARY KEY,
3 ksiazka_id INT NOT NULL,
4 czytelnik_id INT NOT NULL,
5 data_wypozyczenia DATE NOT NULL,
6 data_zwrotu DATE
7);data_zwrotu) faithfully reflects reality - until the return happens, it stays empty.Build this shelf and you will have the foundation of the entire lending desk. This is your Great Work of the scriptorium!