Variables allow users to define specific subsets of data and reuse them in queries to create more structured and efficient results. By using variables, queries become more readable and concise, reducing redundancy while allowing for more complex calculations and comparisons while being more explicit.
Example 1: Defining a VIP Player Segment
In this query, a VIP is defined as any player with Net Gaming Revenue (NGR) greater than 1,000 in the past 6 months. The second part of the query then focuses on which of these VIPs have not logged in within the past 30 days:
VIP = players with casino NGR more than 1000 in the past 6 months. Which of my VIPs have not logged in in the past 30 days?
Example 2: Identifying Multi-Vertical Players Without Deposits
This query defines two distinct groups:
-
ACT CAS = Players who have placed at least one casino wager in the past 30 days.
-
ACT SP = Players who have placed at least one sportsbook wager in the past 30 days.
The final query then identifies which players exist in both groups but have not deposited in the same period:
[ACT CAS] = players with at least one casino wager in the past 30 days. [ACT SP] = players with at least one sportsbook wager in the past 30 days. Which of my customers in [ACT CAS] are also in [ACT SP] and have not deposited in the same period?
Using variables in this way simplifies queries while making them more structured, scalable, and easy to interpret.
⚠️ Text enclosed within [ ] is not interpreted as a keyword, ensuring it does not affect query processing.