Only in DbVisualizer Pro
This feature is only available in the DbVisualizer Pro edition.
A powerful way to study database data is to navigate between the tables in a schema by following table relationships declared by Primary and Foreign Keys. DbVisualizer includes a Navigator feature for this purpose, visualizing the relationships graphically while making the data for each navigation case easily accessible in a data grid.
Opening the Navigator
To launch the Navigator:
- Locate the table you want to start the navigation from in the Databases tab tree,
- Double-click the table node to open its Object View tab,
- Select the Navigator sub tab.
The Navigator tab has two parts: a graphical view and a data grid. Initially, the graphical view shows just the selected start table, and the data grid shows the data for the start table.
The data grid is of the same type as you encounter in other parts of DbVisualizer, such as in the Data tab, but extended with a Related Table list and a Tag button.
Data navigation in DbVisualizer means following table relationships declared by Primary and Foreign Keys, using a unique key value. In the example schema shown in the screen shots in this section, there is a table named STORE with a primary key named
STORE_ID. Another table named
CUSTOMER has a foreign key constraint, declaring that values in its
STORE_ID column refer to primary key values in the column with the same name in the
If you use STORE as you start table, you can easily navigate to the
CUSTOMER table for different
STORE_ID values. In the data grid, select one or more columns in the row that holds the
STORE_ID you want to use for navigation. In the figure above, the store where
STORE_ID = 1 is selected.
Next, bring up the Related Table list. It lists all tables the
STORE table is related to through Primary and Foreign Keys, with the key columns within parenthesis. A forward arrow (->) between the table names means that the STORE table has a foreign key relation to the named table. A backward arrow (<-) means that the named table has a foreign key relation to the
When you select "STORE(STORE_ID) <- CUSTOMER(CUSTOMER_ID)" in the Related Table list, a node is added to the graph for the CUSTOMER table, with an arrow from the STORE table node to show the navigation direction. We call this a navigation case.
The CUSTOMER node contains the key columns (just one in this example) and their values.
The arrow between the nodes is labeled with the key column name. In addition, the arrow label also shows the name and value of the column that you selected in the
STORE table when you created this navigation case, i.e., the STORE_ID column. If you select multiple columns when you create a navigation case, all non-key column names and values are included in the arrow label. This can make it easier to see at a glance what a navigation case represents.
The grid is also updated when you create a navigation case, to show all rows in the table you navigated to that has a key value corresponding to the selected key value in the table you navigated from. In this case, it shows all rows in the
CUSTOMER table with
STORE_ID equal to
You can edit the grid values, but be aware that if you change the value of a key in the grid for a navigation case, the row will disappear from the grid since the grid only shows rows with keys matching the navigation case key value.
You can continue to create more navigation cases from any node in the graph. For instance, if the schema contains a table with job history information for employees, you can navigate to the rental history for an employee from the CUSTOMER node. Or, you can select the STORE node in the graph to navigate to the
CUSTOMER table for a different store. Just click on the STORE node, select another row in the data grid and then the same Related Table list entry.
If you want to create multiple navigation cases from one table to another using the same relationship, you can select columns in multiple rows in the first table. When you make a selection in the Related Table list, one navigation case per row is created.
Every time you select a node in the graph, the data grid is updated to show the corresponding data. The grid settings for one node are independent of the settings for another node. For instance, if you define a filter for one node, the filter is only associated with the grid for that node.
Adding Context Information to the Graph
The navigation node always shows the key columns and their values, but sometimes you may want to add other columns to the node to better describe what it represents. This is called tagging the node.
There are two ways to do so: drag and drop cells from the grid to any node, or use the Tag button in the grid toolbar to tag the currently selected node with the currently selected cells in the grid.
To drag and drop cells to a node, select one or more cells in the grid. With the left mouse button pressed and the mouse positioned over one of the selected cells, drag the cells over a node in the graph and release the mouse button. The cells are added to the node.
Arranging the Graph
As you add navigation cases, you may find that you need to move nodes around, remove some nodes, zoom and move around in the graph, etc.
You can rearrange the layout of the graph by selecting a node and, with the left mouse button pressed, drag it around. The arrow and its label move with the node.
The toolbar for the graph offers a number of tools to help you with other tasks.
Exporting and Printing the Graph
You can also export the graph to an image file or print it. Use the corresponding toolbar buttons to do this
Opening the Navigator from the Data tab
Sometimes, you may realize that you want to analyze the relationships for a table when you are working with it in the Data tab. If you have configured the Data tab to show only filtered data, sorted in a specific way, etc. opening the Navigator tab and making all the same configurations there may be a bit of a hassle. A more convenient way is to just pick Show in Navigator in the right-click menu in the Data tab. It opens the table in the Navigator tab with all the same configurations as you made in the Data tab.