# Using the RDB Schema Editor

OEPE allows you to examine and edit your database schema using the RDB Schema Editor that displays tables and the relationships between them.

The editor displays tables as table nodes. Each node lists all the columns in a table and shows column data types. The node also provides primary and foreign key indicators in a form of icons. Foreign key relationships between tables are represented by links in a form of arrows.

## How to Display a Database Schema in the Editor

Before you can use the RDB Schema Editor you must set up and configure a database connection. For more information, see Creating a Connection to a Database.

You can open the editor from:

- A schema

- A table in the schema. In this case, the table is selected in the editor when it opens.

To open the RDB Schema Editor:

1. Choose Window > Show View > Data Source Explorer from the top-level menu. This opens the Data Source Explorer view.

2. Expand the database connection node to the database, and then to the schema or a particular table in the schema.

3. Right-click on the schema or table name, and choose edit. OEPE builds a graphical model for the database schema and opens the editor to display the tables in the schema and their relationships.

## Working with RDB Schema Editor Features

The schema editor gives you a visual view of your database schema and the relationships between the tables. In the editor, you can:

- Manipulate the layout of the schema in the editor. Select one table using the Select tool in the Palette, or a group of tables by selecting the Marquee tool in the Palette and drawing around the tables you want.

  Move tables by selecting one or more of them and dragging to a new position. Move foreign keys by clicking on the line to create a bend point, then drag the bend point to the new location.

  When the editor is saved, the layout is also saved so that the next time the editor is launched from the same schema the saved layout is used.

- When you select a single table some editing tools become available.

  - To add a column, click + and edit the new column entry in the table.

  - To delete a column, select it and click X.

  - To show the table properties, click Show in Properties View. The Properties window, which opens by default under the schema editor, displays detailed information about the selected table, column or foreign key. You can edit any fields in the Properties window.

  - To save changes to the table, click Save.

- Edit table names, column names, column types and other column constraints such as size and scale. When the editor is saved, all the tables on the diagram are compared against the database. If a table is found to be different than what is in the database, either:

  - An ALTER TABLE statement is used to update the table in the database.

  - If that is not appropriate, for example, when columns are reordered, the table will be dropped and recreated. OEPE will warn you if the table being dropped contains data.

- You can create foreign keys using the Foreign Key in the Palette. Click on the source table then on the destination table. The Define Foreign Key wizard opens where you can specify the column mappings. When you click Finish in the wizard, the foreign key is created.

- You can drop foreign keys by choosing the Select tool from the Palette, selecting the foreign key and pressing delete.

The context menu of the editor allows you to perform the following:

- Refresh the schema in the editor.

- Add a new table.

- Select all tables.

- Select all nodes.

- Show a grid.

- Show guides.

- Automatically adjust the layout horizontally or vertically.

- Zoom in, zoom out, or zoom to the actual size.

- Save the layout as a PNG image file.

- Send the layout to a printer.