POWER
The POWER function raises a numeric value to the power of another numeric value.
POWER Syntax
Use the following syntax when incorporating POWER functions in queries:
POWER(expression1,expression2)
Where expression1 is value to perform the calculation on, and expression2 is the power to raise expression1 by.
POWER Examples
The example queries in this section run against the AnzoGraph sample Tickit data set, which captures sales activity for a fictional Tickit website where people buy and sell tickets for sporting events, shows, and concerts. You can load and explore this data set. For more information, see Working with the Tickit Data.
The following example queries the sample Tickit dataset to raise the total number of tickets sold for each event by the power of 2:
SELECT ?event (POWER(?tickets, 2) AS ?power_total) FROM <tickit> WHERE { SELECT ?event (sum(?qty) as ?tickets) WHERE { ?sales <qtysold> ?qty . ?sales <eventid> ?eventid . ?eventid <eventname> ?event . } GROUP BY ?event ORDER BY desc(?tickets) LIMIT 10 }
event | power_total -----------------+----------------- Mamma Mia! | 13380964.000000 Spring Awakening | 9150625.000000 The Country Girl | 8242641.000000 Jersey Boys | 7733961.000000 Macbeth | 7469289.000000 Chicago | 6426225.000000 Legally Blonde | 5161984.000000 Spamalot | 4835601.000000 Rhinoceros | 3648100.000000 Thurgood | 3587236.000000 10 rows