Data Lake • Write your own SQL

SQL in Analytics

Can I use SQL on my saved models too?

Try this

  • Ask Analytics to run this: DESCRIBE shop_orders

  • Ask Analytics to run this: SELECT region, SUM(amount) AS revenue, COUNT(DISTINCT customer_id) AS buyers FROM shop_orders GROUP BY region ORDER BY revenue DESC

In plain words

What is it?

Analytics also runs SQL, but over your saved models, not your tables.

How does it work?

You use the model's name, such as shop_orders, with no group in front. DESCRIBE shows its columns and the formula of each measure.

Good to know

Copy a measure's formula to get the same number everyone else gets. Save the shop_orders model first: the Analytics quickstart shows how.