Basic Syntax
Inner Join
Returns only matching rows from both tables.| Database | Output |
|---|---|
| PostgreSQL | SELECT * FROM orders INNER JOIN users ON user_id = id |
| MySQL | SELECT * FROM orders INNER JOIN users ON user_id = id |
| MongoDB | db.orders.aggregate([{ $lookup: { from: 'users', localField: 'user_id', foreignField: '_id', as: 'user' } }]) |
Left Join
Returns all rows from the first table, matched rows from second.| Database | Output |
|---|---|
| PostgreSQL | SELECT * FROM users LEFT JOIN orders ON id = user_id |
| MongoDB | db.users.aggregate([{ $lookup: { from: 'orders', localField: '_id', foreignField: 'user_id', as: 'orders' } }]) |
Right Join
Returns all rows from the second table, matched rows from first.| Database | Output |
|---|---|
| PostgreSQL | SELECT * FROM orders RIGHT JOIN users ON user_id = id |
Full Join
Returns all rows from both tables.| Database | Output |
|---|---|
| PostgreSQL | SELECT * FROM orders FULL JOIN users ON user_id = id |
Cross Join
Returns Cartesian product of both tables (no ON clause needed).MongoDB Note
MongoDB uses$lookup aggregation for joins. OmniQL automatically translates JOIN syntax to the appropriate aggregation pipeline.
Limitations
Current JOIN implementation has these constraints:- One JOIN per query (no chained joins)
- No table aliases
- No column selection within JOIN queries
- Field names only (no
Table.fieldnotation)

