Welcome one last time, @name! Look how far you have come. When you stood at the Library Gate, you could not write a single
SELECT. Today you know filtering (WHERE), sorting (ORDER BY), joins (JOIN), grouping (GROUP BY), subqueries, indexes and transactions. I am proud of you.But a true master does not merely read the catalog - they create it. So I set before you one final challenge: you will design your own small library system.
In this location we will revisit the whole art of data management, but this time from the architect's side:
INSERT statement.HAVING to draw out hidden knowledge.A foreign key (
FOREIGN KEY) is a cross-reference between shelves. It points to a column in another table and ensures the value always matches an existing row:1CREATE TABLE recenzje (
2 id INT PRIMARY KEY AUTO_INCREMENT,
3 ksiazka_id INT,
4 tresc TEXT,
5 FOREIGN KEY (ksiazka_id) REFERENCES ksiazki(id)
6);Here
ksiazka_id always points to a real book on the ksiazki shelf. Thanks to this, no "ghost" review will ever exist - an opinion about a book that is not there.Take a deep breath. It is time to create something of your own. THE TREASURY OPENS FOR YOU!