---
title: Learn BQL by doing
summary: Ten lessons that take you from your first GET query to grouped, unit-converted, parameterised queries.
order: 10
terms: [bql, demo-model, qid, pset, quantity-set]
see-also: [reference/bql/cheatsheet, how-to/query/run-a-bql-query, explanation/the-query-languages]
featured: true
---

# Learn BQL by doing

[[term:bql|BQL]] is the query language of BIM.works: one statement selects objects from one or more models and says which of their features you want back. This course teaches it by doing. Every lesson ends in rounds where **you** write the query: the goal says what the result has to be, you edit until it is, and the page runs your query and the lesson's own solution against the same demo model and compares the two. Any query that produces the right result passes — there is no expected text, only an expected result.

```course
course: tutorials/bql
```

## What you will learn

| Lesson | You can do this afterwards |
| --- | --- |
| [Your first query](your-first-query.md) | Select objects by IFC type and read their attributes. |
| [Filtering with WHERE](filtering-with-where.md) | Combine conditions, compare strings and numbers, match patterns. |
| [Properties and quantities](properties-and-quantities.md) | Read property sets and quantity sets, with and without knowing the set name. |
| [Relations](relations.md) | Follow an object to its storey, its type object and the elements around it. |
| [Grouping and aggregates](grouping-and-aggregates.md) | Count, sum and collect per group; order and page the result. |
| [Units and parameters](units-and-parameters.md) | Convert units in the result, use unit literals, and bind values at run time. |
| [Calculated values](calculated-values.md) | Use the quantities, bounding boxes and consistency flags BIM.works derives from the geometry. |
| [Surveying a model](surveying-a-model.md) | Ask an unknown model what it contains before you query it. |
| [From query to IFC](export-to-ifc.md) | Cut a partial model out of a version and open it in another viewer. |
| [Final challenge](final-challenge.md) | Write a full statement, with relations, quantities, units and ordering, unaided. |

The lessons build on each other: a later lesson uses the constructs of the earlier ones without explaining them again. Follow them in order the first time.

## The demo model

Every account has a demo folder with `IFC Schependomlaan.ifc`, an IFC2x3 model of a small Dutch apartment building. The lessons refer to it as *Schependomlaan* and rely on a few facts about it:

- Six storeys, named `-1 fundering`, `00 begane grond`, `01 eerste verdieping`, `02 tweede verdieping`, `03 derde verdieping` and `04 dak`.
- 934 walls (652 `IfcWall` and 282 `IfcWallStandardCase`), 279 slabs, 259 windows, 205 doors and 100 spaces, among others.
- Standard property sets such as `Pset_WallCommon`, `Pset_DoorCommon` and `Pset_SpaceCommon`, plus the authoring tool's own sets (`ArchiCADProperties`, a Dutch set called `eigenschappen`).
- A `BaseQuantities` quantity set on most building elements (932 of the 934 walls), next to the authoring tool's own `ArchiCADQuantities` and, on the doors, a supplier's sets.
- Lengths are millimetres in the file; BIM.works converts to whatever unit you ask for.

Object names are Dutch: walls are called `binnenwand` (inner wall) or `buitenblad` (outer leaf), doors `stelkozijn` or `D1L`, spaces `woonkamer` (living room) or `keuken` (kitchen). You do not need to understand them, only to type them.

## How a round works

A round is the block with **Goal** at its top. It has the goal, an editor with a starter query, and three buttons:

- **Run** (or Ctrl+Enter) executes your query on the demo model, then executes the lesson's solution, and compares the results. **PASSED** means your result is the one the goal describes; **TRY AGAIN** says what is different — too many objects, a missing column, the wrong order. A query that does not parse comes back with the server's own message and the line it stumbled on.
- **Hint** reveals one hint at a time.
- **Reset** puts the starter query back.

The comparison is on the result, never on your text, so every correct way of writing the query passes: another column order, an `AS` alias, `type NI =` where it makes no difference, a wildcard instead of a set name. Where a round has well-known alternatives, they are listed under *Also accepted* in the solution, and a test proves each of them passes. A few rounds are stricter on purpose, because the point of the round is a construct rather than the result: they insist on `LIMIT`, on `UNIT`, on `USING`, on a named column or on a parameter, or they refuse a hard-coded property-set name. The round says so when that is what went wrong.

The **solution** stays hidden until you have run a wrong query twice. Reading it earlier would cost you the lesson; running a query that does not work costs you nothing.

```note
The rounds run against your own instance with the demo API token BIM.works stores in this browser when you sign in. Open BIM.works once in this browser and the rounds work; without it the goal, the hints and the solution are still there to read, and every query also runs in the Actions tree of the app ([[page:how-to/query/run-a-bql-query]]).
```

Your progress is kept in this browser (per instance), not on the server: the dot next to each lesson in the rail shows what is passed, in progress or untouched, and the panel at the top of this page counts the rounds and can forget them again.

## Conventions

A few conventions hold everywhere in BQL, and the lessons assume them from the start:

- Keywords are uppercase (`GET`, `WHERE`, `GROUP BY`); IFC class names too (`IFCWALL`, never `IfcWall`).
- Strings are double-quoted (`"woonkamer"`) and booleans lowercase (`true`, `false`); a feature written on its own means "has a value", and `NOT` in front of it means it has none.
- Feature names are dot paths: `attribute.Name`, `property.Pset_WallCommon.IsExternal`, `quantity.BaseQuantities.NetVolume`.
- There is no `FROM`: the models a query runs on are chosen by the caller, not in the query.

When you want the full picture of a construct, follow the reference links in each lesson; the [[bql:cheatsheet]] fits on one page and is a good companion while you learn.
