Copy-ready commandSQL JOIN
SELECT u.name, d.name AS department FROM users u JOIN departments d ON d.id = u.department_id;Requirements and permissions
- Requirements
- Appropriate database client and connection
- Permissions
- Database privileges vary
- Last reviewed
- 2026-07-31
Examples
Basic example
Join related tables.
SELECT u.name, d.name AS department FROM users u JOIN departments d ON d.id = u.department_id;Common errors
Command not found
Confirm Appropriate database client and connection is installed and available in your current shell.