Examples
Real-world SemQL queries from simple to complex
Simple queries
List all records from a model
SELECT name, email FROM customersFilter with a predefined filter
SELECT name, email
FROM customers[enterprise]Filter with a WHERE clause
SELECT name, region, created_at
FROM customers
WHERE region = 'Europe'
ORDER BY created_at DESCUse a measure (no aggregation in the query needed)
SELECT name, total_revenue
FROM customers
GROUP BY name
ORDER BY total_revenue DESC
LIMIT 10Filtering and aggregation
Revenue by region, for a specific year
Top products by order count, last 30 days
Active organizations with more than 5 users
Monthly revenue trend
Joins
Organizations with their user counts
Orders with customer details
Revenue per account manager (three-way join)
Window functions
Rank customers by revenue within each region
Month-over-month revenue change
Running total of revenue
CTEs
Two-step analysis: find top regions, then show their details
Cohort comparison using CTEs
UNION
Compare two time periods side by side
Combine two segments into a single report
Geo functions
Stores within 50 km of a city, sorted by distance
Customers grouped by proximity band
Putting it all together
Full customer health report
Last updated