Hands-on task
Books and authors with a JOIN
The library database has the tables authors(id, name, country) and books(id, author_id, title). For every book, output the pair author|title, sorted alphabetically by book title, into /root/catalog.txt (psql -tA format, fields separated by |). Authors without books don't go into the list.
Write the query in the file /root/books.sql in the Editor tab — a multi-line JOIN is easier to read there — and run it with psql.
- join
- inner join
- foreign key
- order by
- psql -tA