How to Create a SQL Query

1.    Access the Data Analytics module.

2.    In the SQL Queries section, click Create New (see figure below)

 

 

The system displays a page where the query can be configured (see figure below).

 

 

 

3.    In the Name field, enter a name to identify the SQL query using a maximum of 400 characters.

4.    In the Database field, mark the option next to the database you want to use in the query. External MS SQL Server databases can be made available through the system configuration file. For more information, contact your system administrator. 

5.    In the Description field, provide a description for the query using a maximum of 5,000 characters.

6.    In the SQl Query field, enter the SQL code of the query using a maximum of 150,000 characters. 

 

Note: Databases cannot be edited through SQL queries and, therefore, the "INSERT", "DELETE", "DROP", "TRUNCATE", "EXEC", "ALTER", "SHUTDOWN", "COMMIT", "EXECUTE" and "CREATE" commands will cause execution errors. If you try to execute a query with one of these commands, an error message will be displayed stating that the SQL query is invalid.

 

7.    Click Execute SQL Query to validate the SQL query and view its results. Note that only the first 5,000 rows of results will be displayed. 

 

If no errors were found in the SQL query, the system runs the query and displays the results obtained (see figure below).

 

 

8.    To save the SQL query, click Save. If you want to quit the operation, click Cancel.

 

The system displays a success message. All saved SQL queries are available for inclusion as data sources in the dashboards from this module.