Using Query Tool

In this tutorial you will learn how to use Sohag Builder to execute and generate SQL queries.

This tutorial uses SQLite version of chinook database, you can download it from here.

You may follow the same steps using any other database.

  1. Connect to database.

  2. Write, generate and execute queries.

  3. Other functionalities.

1- Connect to database.

Hit connect button (first button in the toolbar), or use file menu to connect to database.

Sohag Builder connect to database

Sohag Builder connect to database

From the connection dialog choose SQLite from the database type list. Use browse button to set the database location.

sohag builder connect to sqlite db

Press the connect button. The connection dialog will disappear and the database info pane will be opened at the left, The database info pane contains a list of database tables and views attached to their database schema.

sohag builder database info

To open a new Query tool, press the SQL button the second button on the toolbar.

The Query tool is constructed of three parts. SQL Editor at the top, control buttons at the middle and the result pane and SQL history pane at the bottom.

Sohag Builder Query Tool to execute sql queries

2- Write, generate and execute queries.

Now write the following query in the SQL editor.

SELECT AlbumId,Title,ArtistId FROM main.albums;


 Sohag Builder displays an auto complete list for SQL reserved words after writing the 3rd letter in the word .
To display the list manually press Ctrl+Space key combination

Now press Execute button or F5 (Also Execute from the Query menu will do the same functionality) to execute the query.


Sohag Builder Executing Query In Query Tool


A brief description about every executed query appended to the result summery .

Query Tool adds a new tab contains the result of every SELECT statement.


Sohag Builder SELECT statment result


Query Tool can generate SQL statements (SELECT, INSERT, UPDATE, DELETE, DROP), to generate statements select the table or view  first from the database info pane and then press F8 for SELECT, F9 for INSERT, F10 for UPDATE, F11 for DELETE and F12 for DROP or press the button that corresponds to the operation you want to execute at the bottom of the database info pane.


You also can generate SELECT statement by activating the table or view name in the database info pane (mouse double click or using Return key).


 Generated statement will be appended to the end of SQL editor for the current Query Tool, If the current tab is not a Query Tool or no Query Tool is opened a new Query Tool will be opened first.
Every Query Tool has it's own database session.



3- Other functionalities.

1- Execute Once.

This option determines the query execution mode, Query Tool has two modes to execute the SQL editor code.

A- Single query mode (When Execute Once is checked).

In this mode all SQL Editor contents are executed as one query (will be sent to the database as one block without any processing).


B- Multiple query mode (When Execute Once is unchecked).

In this mode the SQL Editor contents are processed to remove white spaces, comment blocks then divided into queries to create a query queue which is executed one by one, multiple query mode is the default mode.



 To add multiple queries every query must end with semicolon ; followed immediately by a new line.

2- Clear.

This will clear both SQL editor and results pane, SQL history will not be cleared.

3- Commit.

To commit the current transaction.

4- Rollback.

To rollback the current transaction.


Every Query tool starts a transaction at opening.
COMMIT or ROLLBACK commands ends the current transaction and starts a new one immediately.

5- Load.

Loads SQL file from the file system.

6- Save.

Saves the contents of SQL editor to the disk.

7- Export.

Exports the current SELECT result tab to CSV format.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
4 + 14 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.