Table
The table widget renders query results as a sortable data grid. Use it when you need to display multiple columns or when a chart does not adequately represent the data.
Use it for:
- Detailed breakdowns with several dimensions
- Top N lists with multiple attributes
- Raw event inspection
- Data exploration before building a chart
Query requirements
Section titled “Query requirements”A table widget accepts any SELECT that returns one or more columns. There are no restrictions on the number of columns or rows (within reasonable limits).
For simple queries, use simple mode:
Select: platform AS "Platform", count() AS "Total Records"
Filters: WHERE name = 'app_started' GROUP BY platform ORDER BY "Total Records" DESC
For multi-level aggregations that need a subquery, use full query mode:
SELECT identity, country, app_version, count() AS sessions, round(avg(duration), 1) AS avg_duration_minFROM ( SELECT identity, country, app_version, session_id, dateDiff('minute', min(timestamp), max(timestamp)) AS duration FROM {table} WHERE name = 'app_started' GROUP BY identity, country, app_version, session_id)GROUP BY identity, country, app_versionORDER BY sessions DESCLIMIT 100Inspecting JSON fields
Section titled “Inspecting JSON fields”The table widget is particularly useful for exploring the contents of the value and custom JSON columns before you know their internal structure.
Select: value, custom
Filters: WHERE name = 'level_completed' LIMIT 10
Once you can see the field names, access them with dot notation in subsequent queries:
Select:
toString(value.level) AS level,toString(value.difficulty) AS difficulty,count() AS completionsFilters: WHERE name = 'level_completed' GROUP BY level, difficulty ORDER BY completions DESC
Common examples
Section titled “Common examples”Platforms breakdown (the default widget created with every project)
Select: platform AS "Platform", COUNT(platform) AS "Total Records"
Filters: WHERE name = 'app_started' GROUP BY platform ORDER BY "Total Records" DESC
Top 20 users by session count
Select: identity, country, uniqExact(session_id) AS sessions
Filters: WHERE name = 'app_started' GROUP BY identity, country ORDER BY sessions DESC LIMIT 20
Recent events
Select: timestamp, name, identity, platform, app_version
Filters: ORDER BY timestamp DESC LIMIT 50