5. Examine the database components using DbXaminer
The ORM Workbench provides DbXaminer to render database diagrams.
The DbXaminer
renders the database diagram for a specific schema, table, or column
maps out the relationships between the tables, the primary keys, and foreign keys
5.1. Examine the relationship between database tables
In DbXplorer, right-click the database connection SalesDBConnection and select Show in DbXaminer
The DbXaminer renders the database diagram for the selected schema or the selected database connection. It displays list of tables along with columns under the table. The DbXaminer also renders the relationship between database tables. The relevant properties of each selected artifact is displayed in Properties view. To switch to a different Connection, Database, or Schema, use the appropriate pull down menu.
With Mouse-over on specific database component, the DbXaminer renders properties of that database component as tool-tip.
In Database Diagram view, you can perform various operations like Zoom In, Zoom Out, Auto Arrange the database components etc.
5.2. View data for a table or column
To view the data for a table or column, select specific component in Database Diagram view and click the Show Data button in toolbar of DbXaminer.
Workshop generates the appropriate SQL query and displays the results in the SQL Editor tab of the DbXaminer
You can sort the data by clicking the column name.
Similarly, to view data of specific column of a table, select column of table in Database Diagram view and click the Show Data button.
5.3. Define SQL query and Add / Edit / Delete data using SQL Editor
In this step, you will use the SQL Editor to define and run SQL statements, display and sort query results, and add new data.
5.3.1. Define and run SQL statements
When defining an SQL statement in SQL Editor, Workshop Studio provides code completion for SQL keywords and the database artifacts by pressing CTRL+SPACE.
First, we will define an SQL SELECT query using the code completion facility.
In SQL Editor, enter S and press CTRL+SPACE.
It displays a list of SQL keywords starting with letter S.
Select the keyword SELECT keyword.
Enter space and press CTRL+SPACE. It displays list of table columns from database and SQL keywords. Select the column PRODUCT.PRODUCTID from the list.
Similarly, select columns PRODUCT.CODE and PRODUCT.NAME. Note: Separate each column by comma.
Enter FROM (You can use code completion for FROM keyword) and space.
Press CTRL+SPACE to get a list of tables and select the PRODUCT table.
Now, we have defined the SQL
SELECT query. You can execute them by either clicking the Execute selected SQL command button or by using the hotkey, CTRL+ENTER.
5.3.2. Add new data to the database table
To add a new row to an existing table, click the New Table Row button in SQL Editor.
From within the Insert Row dialog, select a PRODUCT Table from the drop down menu and fill in the appropriate column information as shown below.
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.).
Run the SQL SELECT
query to retrieve all data from the PRODUCT table and verify the new record being added.
5.3.3. Edit data for a table column
In SQL Editor, select a record of PRODUCT table having PRODUCTID 70 and click the Edit Table Row button.
In Edit Row dialog, change the value of UNITPRICE column
to 150.
Click OK.
It updates the UNITPRICE column value from 210 to 150 for the PRODUCT table record with PRODUCTID 70.
5.3.4. Delete record of a table
In SQL Editor, select a record of PRODUCT table having PRODUCTID 70 and click the Delete Table Row button.
Click Yes in Delete Table Row dialog.
The Workshop deletes the record of PRODUCT table having PRODUCTID 70.
Click one of the following arrows to navigate through the tutorial: