Queries
Plato
Posted on May 31, 2025
Queries
In Plato, you query tables not with SQL but with visual controls for filtering, sorting, hiding, and joining.
Joins
Joining tables together
To gather all the data needed for a workflow, you must often join together two or more tables. To process appointments, for example, a medical provider may need to join the appointments table with a table containing data on the users scheduling the appointments. In Plato, they can join these tables by expanding a foreign key column.
A foreign key is a special type of column that links a child table to a parent table. In Plato, the child table offers an Expand control that lets you expand foreign keys. When a foreign key is expanded, all the columns from the parent table are joined into the child table, creating new columns with names such as users.name or users.address.
Note: Plato does not yet support deeply nested joins traversing multiple foreign keys.
Backlinks
Expanding foreign keys is a great way for our medical provider above to view user information alongside each appointment, but what if they also want to see all the appointments for a given user? One way is to filter the appointments table by the user’s ID, but this such a common need that Plato offers a convenient builtin feature: backlinks.
For every foreign key, Plato places a backlink column on the parent table pointed to by the key. So in our example above, the users table will contain a backlink, “appointments”, that the medical provider can click to view all appointments for that user. It’s a great way to navigate one-to-many and many-to-many relationships in Plato.
Save queries as views
In Plato, queries are stored as views. You can create, delete, and select views in the view selector at the top left of your table. Every table initially has a single view named “Default”.
Each view is visible to all members of your workspace.
Save views as virtual tables
A common pattern in Plato is to construct a query that presents data in a way that’s most convenient to another user, such as a support agent or operator. You may choose to construct this query, save it as a view, then share it, but this exposes the low-level query details to the other user who a) doesn’t care about those details and b) may want further query the data without disrupting the original view. This is where virtual tables come in.
A virtual table lets you present the results of a query as if it were its own table. It allows you to share a new view on your data without exposing the details of how it was constructed.
To create a virtual table:
Use the control bar at the top of the app to construct a query.
Click the view menu in the left-hand side of the control bar.
Click “Add View”.
Enter a name for your view.
Click on the dotted menu on the right-hand side of the control bar and select “Create virtual table from view”.
Enter a name for your virtual table.
Click “Submit”. Your new virtual table will appear in the left-hand nav bar.
(Optional). By default, a new virtual table is only visible to the user who created it. To share with other members in your workspace, right click on the virtual table and select “Make visible to team”.
Notes
A virtual table is based on the view used to define it. If that view is changed, the virtual table will also change.
To see which view a virtual table is based on, hover over the info icon in the nav bar entry for the virtual table.