Query Data in EMQX Tables
EMQX Tables provides powerful and flexible ways to query your data. You can use either SQL or Prometheus Query Language (PromQL), depending on your query style and use case.
All data stored in EMQX Tables can be queried from the Data Explorer in EMQX Cloud.
The Data Explorer allows you to:
- Select a query language (SQL or PromQL)
- Define a time range and query resolution
- Explore tables, fields, and tags
- Visualize query results interactively

Both SQL and PromQL queries are executed against the same data model and return consistent results, differing only in query syntax and analytical style.
SQL Queries
SQL is the most flexible way to query EMQX Tables.
Use SQL when you need to:
- Perform ad-hoc data exploration
- Filter, sort, and aggregate data
- Query specific columns or time ranges explicitly
- Work with structured or semi-structured IoT data
SQL queries in EMQX Tables are extended to work naturally with time-series data, making them suitable for both traditional analytics and time-based analysis.
Refer to Use SQL to Query Data for syntax, examples, and best practices.
PromQL Queries
PromQL is designed specifically for time-series analysis.
Use PromQL when you want to:
- Calculate rates, increases, and deltas over time
- Perform rolling or window-based aggregations
- Apply Prometheus-style metric analysis
- Reuse existing PromQL knowledge and dashboards
EMQX Tables supports PromQL natively, including multi-field tables and additional extensions such as field selection and cross-database queries.
Refer to Use PromQL to Query Data for supported features, examples, and limitations.