Time to give the Library its first order! The most important command in SQL is SELECT - "show me the data".
The asterisk
* means "all columns":1SELECT * FROM ksiazki;This means: "Show all fields of all books on the ksiazki shelf". The Library will return the entire contents of the shelf.
Usually we don't need everything. We can ask only for specific fields, listing them separated by commas:
1SELECT tytul, autor_id FROM ksiazki;This means: "Show only the title and the
(the cross-reference to the author) of each book". The rest of the fields will be omitted. In the autor_id
ksiazki shelf we store the author as the autor_id column - a cross-reference to the authors shelf.1SELECT tytul, rok_wydania -- WHICH columns you want to see
2FROM ksiazki; -- FROM WHICH shelf (table)* for all).Remember: SELECT always goes hand in hand with FROM. Without naming the shelf the Library does not know where to look!