Previous Next vertical dots separating previous/next from contents/index/pdf

Step 5. Examine the Database Components Using DbXaminer

Workshop's DbXaminer renders database diagrams for a specific schema, table, or column and maps out the relationships between the tables, the primary keys, and foreign keys. The DBXaminer also provides an SQL editor that allows you to author queries and update data.

The tasks in this step are:

To Examine the Relationships Between Database Tables

To View Data for a Table or a Column

To Use the SQL Editor to Author an SQL query and Add / Edit / Delete Data

To Examine the Relationships Between Database Tables

  1. In DbXplorer, right-click the schema SalesDBConnection and select Show in DbXaminer

  2. DbXaminer renders the database diagram for the selected schema. It displays a list of tables along with columns of the table. DbXaminer also renders the relationship between database tables. The relevant properties of each selected artifact are displayed in Properties view. To move the focus of the database diagram to a different table or row simply click on it. You can also click on a schema, table or row in DbXplorer to change the diagram focus. If you right-click on a schema, table or row in DbXplorer and choose Show in DbXaminer, then the diagram is redrawn to center on the selected element.

  3. When you run the mouse over database components, DbXaminer displays the properties of that database component as a tooltip.

  4. In Diagram view (indicated by the tab at the bottom of DbXaminer view), you can perform various operations like Zoom In, Zoom Out, and Auto Arrange by right-clicking and selecting an option.

To View Data for a Table or Column

  1. To view the data for a table or column, select a specific component in Diagram view and click the Show Data button in the toolbar of DbXaminer.

  2. Workshop generates the appropriate SQL query and displays the results in the SQL Editor tab of the DbXaminer

  3. You can sort the data by clicking the column name.

  4. Similarly, to view data of a specific column of a table, click the Diagram tab, select a column of the table and click the Show Data button.

To Use the SQL Editor to Author an SQL query and Add/Edit/Delete Data

In this task, you will use the SQL Editor to define and run SQL statements, display and sort query results, and add new data.

The parts in this task are:

To Define and Run SQL Statements

To Add New Data to a Database Table

To Edit the Data in a Data Column

To Delete a Record

 

Define and run SQL statements

When defining an SQL statement in SQL Editor, Workshop provides code completion for SQL keywords and the database artifacts when you press CTRL+SPACE. In this step, we will define an SQL SELECT query using the code completion facility.

  1. Click the SQL Editor tab, type S and press CTRL+SPACE. Workshop displays a list of SQL keywords starting with letter S.

  2. Select the SELECT keyword.
  3. Type a space and press CTRL+SPACE. Workshop displays a list of table columns from the database as well as the SQL keywords that would be appropriate.
    Select the column PRODUCT.PRODUCTID from the list.

  4. Type a comma, press CTRL+SPACE and select the column PRODUCT.CODE. Type a comma, press CTRL+SPACE and select the column PRODUCT.NAME. Type a space.
  5. Enter FROM (You can use code completion for the FROM keyword) and type a space.
  6. Press CTRL+SPACE to get a list of tables and select the PRODUCT table.

  7. Now, we have defined the SQL SELECT query. You can execute the query by either clicking the Execute selected SQL command button or by using the hotkey, CTRL+ENTER.

To Add New Data to a Database Table

  1. To add a new row to an existing table, click the New Table Row button in SQL Editor.

  2. From within the Insert Row dialog, select the PRODUCT table from the drop down menu and fill in the appropriate column information as shown below.

  3. Click OK to insert the row into the PRODUCT table. Workshop validates the data prior submission to ensure that it conforms to the column definitions (type, size, etc.).
  4. Run the SQL SELECT query to retrieve all data from the PRODUCT table and verify the new record has been added.

To Edit the Data in a Table Column

  1. In the SQL Editor, select the record in the PRODUCT table that has the PRODUCTID value set to 70 and click the Edit Table Row button.

  2. In the Edit Row dialog, change the value of the UNITPRICE column to 150.

  3. Click OK. Workshop updates the UNITPRICE column value from 210 to 150 for that record.

To Delete a Record

  1. In the SQL Editor, select the record from the PRODUCT table that has a PRODUCTID value set to 70 and click the Delete Table Row button.

  2. Click Yes in Delete Table Row dialog.
  3. Workshop deletes the record.

Click one of the following arrows to navigate through the tutorial:


Still need help? Post a question on the Workshop newsgroup.

 

Skip navigation bar   Back to Top