A query expression allows you to search for specific zettel and perform actions on them.
You may select zettel based on a list of [identifiers](00001006050000), a query directive, a full-text search, specific metadata values, or any combination of these.

A query expression consists of an optional *[zettel identifier list](00001007710000)*, zero or more *[query directives](00001007720000)*, an optional *[search expression](00001007701000)*, and an optional *[action list](00001007770000)*.
The latter two are separated by a vertical bar character (&ldquo;`|`&rdquo;, U+007C).

A query expression follows a [formal syntax](00001007780000).

* [List of zettel identifier](00001007710000)
* [Query directives](00001007720000)
    * [Context directive](00001007720300)
    * [Thread Directive](00001007720500)
    * [Ident directive](00001007720600)
    * [Items directive](00001007720900)
    * [Unlinked directive](00001007721200)
* [Search expression](00001007701000)
    * [Search term](00001007702000)
    * [Search operator](00001007705000)
    * [Search value](00001007706000)
* [Action list](00001007770000)

Here are [some examples](00001007790000) that can be used to manage a Zettelstore:

| Query Expression | Meaning |
| --- | --- |
| role:configuration | All zettel that contain configuration data for the Zettelstore |
| ORDER REVERSE created LIMIT 40 | 40 recently created zettel |
| ORDER REVERSE published LIMIT 40 | 40 recently updated zettel |
| PICK 40 | 40 random zettel, ordered by zettel identifier |
| dead? | Zettel with invalid / dead links |
| backward!? precursor!? | Zettel that are not referenced by other zettel |
| tags!? | Zettel without tags |
| expire? ORDER expire | All zettel with an expiration date, ordered from the nearest to the latest |
| 00001007700000 CONTEXT | Zettel within the context of the [given zettel](00001007700000) |
| 00001012051200 FOLGE | &ldquo;Train of thought&rdquo; of the [given zettel](00001012051200) |
| PICK 1 | REDIRECT | Redirect to a random zettel |