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.

The Data Explorer with the customers frame on the left and, linked by an arrow, the frame customers ▸ orders with the eight orders of the selected customer Elias

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.

  1. Right-click a table on the diagram, such as customers, and choose Data Explorer.
  2. The explorer opens under the diagram, with the table in a frame. To expand it over the whole diagram area, double-click its tab.
  3. Click a row.
  4. Click the arrow button in the title bar of the frame. It lists the tables linked to this one.
  5. 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.
The customers frame with Elias selected and, linked by an arrow, the frame customers ▸ orders listing the orders whose customer_id is 7

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 orders of the customer Elias, filtered with status = 'CANCELLED' to three rows

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

  1. Double-click a cell.
  2. Type the new value. Ctrl+Enter starts a new line inside the cell.
  3. Press Enter to save it, or Esc to cancel.
  4. DbSchema asks "Update 1 cell(s) to … ?". Press OK.
A status cell of the orders frame open for editing, with the value CANCELLED and the Open Editor Dialog and save buttons under it

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

  1. Press + at the bottom of the frame. A new row appears.
  2. Fill in the values. In a linked frame, DbSchema fills in the value of the foreign key for you.
  3. Press the save button at the bottom of the frame.
A new row in the orders frame, with customer_id already set to 7 and the other columns NULL, and the save, add and cancel buttons at the bottom

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.

Next steps