Well done, @name! You leave the Catalog Hall a true scribe. Your queries no longer merely fetch data - they shape it.
*. the order on the SELECT list decides the order in the result.SELECT tytul AS Tytul gives a field a pretty label in the answer.SELECT DISTINCT kraj FROM autorzy returns only unique values.ASC (ascending, the default) and DESC (descending); you can sort by several fields: ORDER BY rok_wydania DESC, tytul ASC.LIMIT 5 takes five rows; LIMIT 5 OFFSET 10 paginates results.Everything together in a single scroll:
1SELECT tytul AS Tytul, cena AS Cena
2FROM ksiazki
3ORDER BY cena DESC
4LIMIT 3;"Show the three most expensive books, with pretty headers Tytul and Cena". Beautiful, is it not?
In the next location you will learn to filter scrolls with the
WHERE clause - to pick only those that meet a condition (e.g. books cheaper than 50, or published after the year 2000). The catalog is ready; it is time to learn to search with precision. Forward!