> For the complete documentation index, see [llms.txt](https://docs.schemajs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.schemajs.com/reference-guides/schemajs-global/query.md).

# query

The `query` static getter in **SchemaJS** provides a method for executing queries built with the `QueryBuilder`. It ensures that only queries constructed using the `QueryBuilder` class can be executed, offering a layer of validation before performing the actual query operation. The method then retrieves the results by calling the internal `searchRows` function, which queries the specified database and table using the built query.

```typescript
const query = new QueryBuilder("public", "books")
    .where("author_age", "=", 25)
    .build();

// Execute the query
SchemaJS.query(query).then((rows) => {
    SchemaJS.print(rows);
});
```
