Relationships and foreign keys
Open the row a foreign key points to, see every table that points back, and write JOINs without looking up column names.
Foreign keys describe how your data connects. Querly turns them into navigation, so you can follow an order to its customer and back to all of their payments without writing a query.
Open the referenced row
Foreign-key cells show a small chevron. Click it and Querly opens the referenced table, filtered to that exact row. You can also right-click a cell and choose Open Referenced Row, or use the same button in the row details panel.
Hover a column header with a foreign-key mark to see what it references, for example References customer(customer_id).
Related tables in row details
Select a row and press Space to open its details. The Related tables section lists both directions:
- Points to: the rows this row references.
- Referenced by: tables that contain rows pointing at this one, such as every
paymentfor a customer.
Click an entry to open that table already filtered to the matching rows.
See who references a table
In a table's Structure view, the foreign-key list shows outgoing keys, and a separate list shows other tables that reference this table. Drop a foreign key or add a new one from the same view.
JOINs written for you
- In the SQL editor, type
JOINand Querly offers the full line with theONcondition taken from the foreign key. See Smart autocomplete. - The Visual Query Builder (in the Table menu) adds joins automatically when you pick related tables.
- The ER diagram draws every relationship on a canvas you can pan and zoom.
Relationships without constraints
Many applications never create foreign-key constraints in the database. When Querly recognises a Laravel database, it infers relationships from naming conventions such as user_id → users.id, and resolves polymorphic columns such as commentable_type. Those columns get the same chevron and the same navigation. See Laravel projects.
Inferred relationships only appear on databases Querly has identified as Laravel. Everywhere else, navigation uses real foreign keys only.