Chapter 3 The Tariscope program
3.5 Working with views
3.5.13 SQL queries for any table
Tariscope provides a possibility to execute a SQL query to any table of the Tariscope database. This possibility can be useful, for example, to check a SQL query that is used in a Tariscope report form or you have a problem with Tariscope. The feature requires the knowledge of the Tariscope database. A description of the database, see in the 'Tariscope 4.x. Database schema'.
To do this, create an empty text file with the ‘sql’ extension. In the Tariscope menu, select File → Open file. In a list of file types, select the SQL query (*.sql) option as shown in Figure 3.5.34.
Figure 3.5.34
It is very important to set this extension.
Select a desired file. A new view is opened in Tariscope where the contents of the file will be displayed.
Write a desired SQL query or a few SQL queries in the view.
Select a desired SQL query and, click on the Run icon on the toolbar. An example of this is shown in Figure 3.5.35.
Figure 3.5.35
If the SQL query is valid, you get a result that is displayed in the Table tab of the view as shown in Figure 3.5.36.
Figure 3.5.36
You can select and copy some cells of the table or the entire table. To do this, select desired cells and, right-click. In the appeared menu, select the Copy item.
Also you can export the table contents to a file with the following extensions: PDF, CSV, HTML or Excel. Right-click in any place of the table and in the appeared menu, select a desired option of an export.
The Message tab contains information about an execution of a SQL query.
If you right-click in the part of the view that contains SQL queries, a menu appears that contains the following items:
- Run. Starts the execution of a selected SQL query.
- Stop. Stops the execution of a SQL query.
- Undo. It erases the last change done to the document reverting it to an older state.
- Redo. It is the opposite of Undo. It reverses the Undo.
- Cut. Allows you to cut a selected data.
- Copy. Provides copying data to the clipboard.
- Paste. Provides pasting data from the clipboard.
- Select all. Provides a selection of the entire table.