SQL Query Tool

SQL queries can be used for retrieving data from the database, creating or changing structure of tables and other database objects, maintaining the database etc.

When retrieving the database data, all users are recommended to use SQL queries instead of using Table objects, due to the following advantages: flexibility for the user, optimized database load, less network traffic (for remote databases) etc. Of course, the results of such queries can be exported, copied, printed in the same way as you do with the Table objects.

If you are not an advanced user, try to start from simple queries like


FROM some_table

WHERE some_condition

and then gradually develop your SQL skills.

The Database Tour contains all you need to create and execute the database queries.

SQL Syntax Highlighting

The SQL editors of Database Tour support syntax highlighting for SQL code. They recognize standard SQL keywords and even specific keywords for some database types. You can customize the highlighting in environment options.

Syntax highlighting in SQL editor

Multiple SQL Windows

Once you opened a database, you can create as many SQL windows as you want (or your operating memory allows). They appear as tabs. This is especially useful when comparing the text from different SQL files or stored procedures, copying text, running queries simultaneously etc.

When you close the database and exit the application, all open SQL windows are kept in the application workspace file and restored when you open the database next time.

Multiple SQL windows

Simultaneous Query Execution

If your database connection allows creating multiple sessions, each SQL window will hold a separate db session. It means that you can execute the queries from different SQL windows asynchronously, without needing to wait when a query from another SQL window is finished.

Each SQL tab shows markers reflecting the execution status of its query: red marker is shown for still executing query, and the green one reports the finished query; a special mark indicates a query finished with error.

In multi-session environment, to save resources of your database, each new database session is created at the moment when you first try to execute a query from the active window.

Asynchronous query execution

Database Queries with Parameters

Database Tour supports parameterized SQL queries. When you execute such a query, the software will ask you to specify the value for each parameter.

Parameterized queries give you some flexibility, i.e. you can run the same SQL command with different values of the same parameter. Also, if correctly used, parameterized SQL statements are executed more efficiently. Read more about advantages of the parameterized queries in your database documentation.

Parameterized SQL query

Running Multi-Statement SQL Scripts

The SQL editors can hold multiple SQL commands. You can execute them either separately (by selecting the text of the needed command) or all together. In the latter case, you can view the statistics of each executed command. Make sure to properly separate the commands; for most database types, semicolon is used to separate the SQL statements.

Executing SQL script

Clickable Table Names

SQL editors recognize table names and some other db objects in the SQL code. When you slightly move the mouse over them holding Ctrl down, they become clickable. When you click the table name holding Ctrl down, this table opens in a separate tab.

Clickable table names in SQL editor

Tools for SQL Code Generation

In Database Tour, you can find many tools to generate SQL code for different purposes:

  • In SQL editors, there is a number of generic DML commands templates. DML stands for Data Manipulation Language, SQL sublanguage. Choose a template, replace the names of the tables and columns with needed ones, correct the data selection conditions (if any), and your query is ready to execute.
  • In the context menu of database objects' lists, there are several items to manage database objects by SQL. Here, you can build SQL code to query data from selected table(s), drop selected object(s), extract db objects' DDL, and other commands. When extracting DDL for multiple selected objects, you can produce a multi-statement SQL script; and there is a possibility to save the script to file or even multiple files, one object per file.
  • When performing certain actions with selected database objects, for example, cloning or editing the objects, you can optionally choose to generate SQL code for the requested operation.

SQL code generation tool