What is the query builder?
In Metabase, the query builder is the graphical interface for asking questions.
If you aren’t a SQL person or just prefer to analyze your data using buttons and dropdowns instead of code, the query builder’s got you covered. And if you aren’t exactly sure what you’re trying to figure out about that data, those buttons and dropdowns can give you some ideas, like listing options for the filters and groupings you can add to your starting table, model, or saved question.
Asking questions with Metabase’s query builder
There are a couple ways you can use the query builder to ask questions about your data:
Construct a question on the fly by browsing your data and adding filters and summarizations using the sidebars to the right of your data visualization.
Create your question from scratch using Metabase’s notebook editor. The notebook editor offers more flexibility for constructing a query: in addition to the regular filtering and summarizing options, you can use custom expressions to create more sophisticated custom filters and summarizations. You can also join tables and create custom columns in the notebook editor, previewing your results at each step before visualizing the final product.
These paths aren’t mutually exclusive — you can start in the notebook editor, visualize your data, use the sidebars to tweak your question, return to the notebook editor to make additional changes, and so on.
Example: using the query builder
We’ll use the query builder to construct a question using Metabase’s Sample Database, starting with the notebook editor, then adding a second filter once we’ve visualized our data. Let’s say we want to know how our large orders (that is, orders with a
Subtotal greater than $100) are broken out by
Product → Category. Figure 1 shows how we’d construct this question in the notebook editor:
Once we visualize that data, let’s add another filter so we’re only viewing full-price orders (orders where there was no discount applied). Figure 2 shows what our query builder looks like just before adding that second filter:
Did this article help you?
Thanks for your feedback!