Data Explorer
The Data Explorer shows the rows of a table and of the tables linked to it. Click a customer, and the next table lists that customer's orders. You can also edit, add and delete rows there, without writing SQL.
The Data Explorer works on the database that DbSchema is connected to. Every change that you save there is applied to the database at once. It does not change your DbSchema design.
Follow a foreign key to related rows
A foreign key is a column that points to a row in another table, such as orders.customer_id.
The Data Explorer uses it to show the rows that belong together.
Each table opens in a frame: a small window inside the explorer with the table's rows.
Following foreign keys requires DbSchema Pro or Architect.
- Right-click a table on the diagram, such as
customers, and choose Data Explorer. - The explorer opens under the diagram, with the table in a frame. To expand it over the whole diagram area, double-click its tab.
- Click a row.
- Click the arrow button in the title bar of the frame. It lists the tables linked to this one.
- Choose a table, such as Cascade orders via orders_customer_id_fkey. Cascade here means: open the linked table and show the rows that belong to the selected row.
A second frame opens, linked to the first by an arrow.
Its title shows both tables, such as customers ▸ orders.
When you click another customer, the orders frame reloads with that customer's orders.
From the orders frame, you can follow another foreign key in the same way, to open order_items or payments.
You can also follow a foreign key in the opposite direction, for example from orders back to customers.
If your database has no foreign keys, the explorer can follow virtual foreign keys. A virtual foreign key exists only in your DbSchema design, not in the database.
Query → Data Explorer, or Ctrl+R, opens an empty Data Explorer instead. Drag a table from the diagram into it to start.
Filter and sort the rows
Each frame has a filter box above its rows.
Type a condition in SQL, such as status = 'CANCELLED', and press Enter.
The frame then shows only the rows that match.
The filter further limits the related rows that the frame shows. Here, the orders frame shows the cancelled orders of the selected customer only. To remove the filter, empty the box and press Enter.
To build a filter without SQL, right-click a column header, the column name above the values, and choose Add Filter .... The same menu has Sort Ascending, Sort Descending and Remove Sorting.
Edit, add and delete rows
Every change here is applied to the database as soon as you save it. To edit or delete rows, the table must have a primary key or a unique index. DbSchema uses it to find the exact row in the database.
Edit a value
- Double-click a cell.
- Type the new value. Ctrl+Enter starts a new line inside the cell.
- Press Enter to save it, or Esc to cancel.
- DbSchema asks "Update 1 cell(s) to … ?". Press OK.
To edit a long text, press the Open Editor Dialog button under the cell. It opens the value in the Edit Cell Value dialog, and OK saves it. The question in step 4 has a Confirm Updates check box. Untick it to skip the question for all later edits.
Add a row
- Press + at the bottom of the frame. A new row appears.
- Fill in the values. In a linked frame, DbSchema fills in the value of the foreign key for you.
- Press the save button at the bottom of the frame.
In the picture, DbSchema sets customer_id to 7, because customer 7 is selected on the left.
To discard a new row before you save it, press the cancel button.
Delete a row
Select one or more rows and press the trash button at the bottom of the frame. DbSchema asks "Delete selected record(s) from the database ?" before it deletes.
Keep the explorer for later
The Edit menu of the Data Explorer has Generate Query in Query Builder. It creates a query in the Query Builder from the tables, joins and columns of the explorer. Filters that you typed are not included in that query.
When you close the Data Explorer, DbSchema asks whether to include it in the project.
- Close and Include keeps it in the project, and Query → Reopen opens it again. The Data Explorer is saved to the project file when you save the project.
- Close and Drop closes the Data Explorer without keeping it. The data in the database stays as it is.
Common problems
"Ups ! Delete or update data requires the table to have a primary key or unique index."
DbSchema uses the primary key or a unique index to find the row. Add a primary key or a unique index to the table, as Tables, Columns and Indexes shows.
The arrow button says "Data Explorer requires the Architect or Pro edition"
Your license does not cover Pro or Architect. Register a license for either edition.
The arrow button says "Table has no foreign keys."
No foreign key links this table to another one. Add a virtual foreign key in the diagram. The Data Explorer follows it in the same way as a foreign key of the database.