Creating and Executing an SQL Query

This procedure describes how you can run an SQL query on your database once you have created it.

You must have created a Connection Profile and connected to your database before using this functionality.

 

 

Instructions on how to complete a procedure

To run an SQL Query on your database:

  1. Open the Database Development perspective by going to Window | Open Perspective | Other | Database Development.

  2. Connect to your Database by following the steps in the "Connecting to a Database" topic.

  3. Click the Open Scrapbook icon dtp_open_scrapbook_icon.png on the toolbar.
    A new SQL scrapbook will open.

pdt_sqlfile.png

SQL File editor

  1. Write your query in the scrapbook (e.g. select * from mytablename;)

  2. To execute your query, right-click anywhere in the editor and select Execute All -or- press Ctrl+Alt+X.
    To execute only specified queries, highlight the relevant lines, right-click and select Execute Selected Text.

The query will be run and the results will be displayed in the Result1 tab in the SQL Results view.

The left pane displays the execution history. For each statement that you execute, including stored procedures, an execution history entry is added to this pane. This allows you to quickly retest the execution using slightly different values and settings. You can rename or delete the launch configurations as needed.

dtp_sql_results_view.png

SQL Results view

For more information on the Data Tools Platform, please see the Data Tools Platform User Documentation.

 

 

link_icon.png

Related Links:

Using the Data Tools Platform

Creating a Database Connection Profile

Viewing and Editing Database Table Content

Creating and Executing an SQL Query