A query is a request for data, answered with a relation. SQL (Structured Query Language) is the language in which relational databases are queried and changed. A query names the columns wanted, the relations they come from and a condition on the rows: SELECT columns FROM relation WHERE condition.
loans JOIN books ON loans.book_id = books.book_id: each loan is matched with the row of books whose key equals its book_id, and the two rows are written side by side as one row of the answer. Without the ON condition, every loan would be paired with every book.