Hands-on task
SQLite: join a table to itself
The database /root/org.db has a table employees(id INTEGER, name TEXT, manager_id INTEGER), where manager_id references the id of a manager in the same table (for the top boss it is NULL). Write a query with a self-join (joining the table to itself) that, for every employee who has a manager, outputs a pair employee|manager, and write the result to /root/pairs.txt.
- self-join
- join
- table aliases
- hierarchy
- sqlite3