Table Data Navigation

DbVisualizer Logo
DbVisualizer 6.0
July 2007
http://www.dbvis.com
support@dbvis.com


[ Master documentation index ]

Introduction

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.

To launch the Navigator, select the table you want to start the navigation from in the Database Objects Tree, and then open the Navigator tab in the  Object View.

Navigator showing the initial table

Figure: The Navigator tab showing the initial table

The Navigator 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 a read-only grid of the same type as you encounter in other parts of DbVisualizer, but extended with a Related Table list and a Tag button. You can learn more about the general data grid in the Data Grid section of the Getting Started chapter. The Navigator specific extensions are described in detail in the following section.

Data Navigation

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 screenshots in this section, there is a table named DEPARTMENTS with a primary key named DEPARTMENT_ID. Another table named EMPLOYEES has a foreign key constraint, declaring that values in its DEPARTMENT_ID column refer to primary key values in the column with the same name in the DEPARTMENTS table.

Related Table list

Figure: The Related Table list

If you use DEPARTMENTS as you start table, you can easily navigate to the EMPLOYEES table for different DEPARTMENT_ID values. In the data grid, select one or more columns in the row that holds the DEPARTMENT_ID you want to use for navigation. In the figure above, the DEPARTMENT_NAME column in the row for DEPARTMENT_ID = 60 is selected.

Next, bring up the Related Table list. It lists all tables the DEPARTMENTS table is related to through primary and foreign keys, with the key columns within parenthesis. A forward arrow (->) in front of the table name means that the DEPARTMENTS 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 DEPARTMENTS table.

Related Table list tooltip

Figure: Tooltip for a Related Table list entry

The Related Table list shows only the table name and columns of the related table, because there is not room for more when a key contains many columns with long names. Sometimes this information is not enough to understand what the relation really means. To make it easier to figure out, you can let the mouse hover over a list entry. A tooltip then shows you the other end of the relation as well, e.g., in the figure above, the tooltip shows that "<- EMPLOYEES (DEPARTMENT_ID)" represents a foreign key from the EMPLOYEES DEPARTMENT_ID column to the DEPARTMENTS DEPARTMENT_ID column.

One navigation case

Figure: Navigation from DEPARTMENTS to EMPLOYEES for DEPARTMENT_ID = 60

When you select "<- EMPLOYEES (DEPARTMENT_ID)" in the Related Table list, a node is added to the graph for the EMPLOYEES table, with an arrow from the DEPARTMENTS table node to show the navigation direction.  We call this a navigation case.

The EMPLOYEES node contains the key columns (just one in this example) and their values.

The arrow betwwen 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 DEPARTMENTS table when you created this navigation case, i.e., the DEPARTMENT_NAME 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 easer 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 EMPLOYEES table with DEPARTMENT_ID equal to 60.

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 for employees, you can navigate to the history for an employee from the EMPLOYEES node. Or, you can select the DEPARTMENTS node in the graph to navigate to the EMPLOYEES table for a different department. Just click on the DEPARTMENTS node, select another row in the data grid and then the same Related Table list entry.

The Navigator tab

Figure: Two navigation cases

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 show 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.

A node tagged with context info

Figure: A node tagged with additional column values

Alternatively, you can select the cells in the grid and click on the Tag button (Tag button) to add the cell values to the currently selected node.

Arranging the Graph

As you add navigation cases, you may find that you need to move nodes around, remove selected 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 moves with the node.

The toolbar for the graph offers a number of tools to help you with other tasks.

The graph toolbar

Figure: The graph toolbar

All these tasks can also be accessed through the graph popup menu.

Reload button Clicking the Reload button removes all navigation cases, leaving just the node for the table you started with.
Show/Hide Controls button You use the Show/Hide Controls button to control the display of an Overview control, see below.
Zoom In button The Zoom In button lets you zoom into the graph, one step per click.
Zoom Out button The Zoom Out button zooms the graph out one step with each click.
Zoom 100% button Clicking the Zoom 100% button zooms the graph so that all items are shown with their standard size.
Fit button Use the Fit button to make all graph items fit in the graph display area.
Relayout Button The Relayout button lays out all graph item with standard positions, distances between items, etc. This can be useful after making manual changes, such as removing nodes or tagging nodes.
Remove Node button The Remove Node button removes the selected node. It is only enabled when a navigation case node is selected.

The Overview control is useful for large graphs that do not fit into the display area.

Overview Window

Figure: Graph with the Overview Window displayed

The gray area in the Overview control indicates the portion of the graph that is currently shown in the display area. You can drag the gray area around to study other portions of the graph.

To get a larger graph display area, you can put the Overview control in a separate window. Just uncheck the Docked checkbox.

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.

Export button Export the graph to a JPG or GIF file.
Print button Print the graph
Print Preview button Show a preview of how the graph will be printed

When you print the graph, you are prompted for information about what to print (the Graph or the View, i.e., just the portion visible in the display area) and how many rows and columns to split the printing over (one page is used for each row/column). See the Export and Print sections in the Export, Import and Print section for details.


Copyright © 2007 Onseven Software AB. All rights reserved.