Well done, @name! You have crossed the Bridge of Knowledge and can already link the Library's shelves with cross-references. Here is what you have gained:
ksiazki.autor_id → autorzy.id).k, a, c, w, kat) shorten column names and make them unambiguous.JOIN clauses.LEFT JOIN with WHERE ... IS NULL finds rows without a pair (e.g. readers with no loans).LEFT JOIN - it keeps rows from the right table.| | INNER JOIN | LEFT JOIN | |---|------------|-----------| | Rows without a pair | disappear | stay (with NULL) | | When to use | we want only complete pairs | we want to keep all rows from the left |
In the next location we will rise above individual scrolls and learn to count and group them - you will meet the aggregate functions (
COUNT, SUM, AVG) and GROUP BY. The bridge is behind us, onward, deeper into the Library!