Comparing some of the key differences between SQL and TQL

Learn about some key differences between Structured Query Language (SQL) and TrackTik Query Language (TQL).


 

Overview

TQL is used to write queries in Data Lab. If you used SQL in the past, you might notice it's pretty similar to TQL. This article compares some of the notable differences between the two languages. When you understand TQL better and build on the information you know, you can create insightful reports to show your most important key performance indicators in Data Lab.


 

Comparing SQL to TQL

In the comparison table, you can see some of the key differences between the two languages:

SQL TQL
Uses wildcards. For example, uses Select * from employees to select all columns in the Employees table.

Doesn't use wildcards. For example, doesn't use Select * from employees. You need to list each column separately.

TQLscript.png

Uses the JOIN keyword to combine information from two different tables.

Uses relation categories with elements and dot notation, so you don't need to use the JOIN keyword. For example, employeeClass.status.

keywordexpansion.png

Has a set foundation of functions. Has many of the same functions as SQL, but not all of them. There is a slight difference in the syntax structure, too. TQL can do TrackTik-specific queries.
It uses casting to convert one type of data to another. For example, 5 starts as an integer or number and can be cast to a string. Doesn't use casting.

Uses variables. You can save data in the variables to use the data elsewhere in a query. For example:

DECLARE @TestVariable AS VARCHAR(100)
SET @TestVariable = ‘One Plane One Life’
PRINT @TestVariable
Variables aren't supported.
Uses aliases to change column names. For example,
Select firstName as 'first name'.

Supports as for column aliases. If you need names with blank spaces or special characters, you must use backticks ("). For example, Select firstName as `first name`.

columnrenameinTQL.png

Allows you to update, edit, and delete information.  Uses only Select operations, so you don't need to update, edit, or delete; the focus is to pull information from a source that already exists.

Uses subqueries (sometimes called nested selects). For example:

SELECT Ord.SalesOrderID, Ord.OrderDate,
(SELECT MAX(OrdDet.UnitPrice)
FROM Sales.SalesOrderDetail AS OrdDet
WHERE Ord.SalesOrderID = OrdDet.SalesOrderID)
AS MaxUnitPrice
FROM Sales.SalesOrderHeader AS Ord
Doesn't use subqueries.


 

See also

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more