> For the complete documentation index, see [llms.txt](https://kotlin-jdsl.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kotlin-jdsl.gitbook.io/docs/jpql-with-kotlin-jdsl/sorts.md).

# Sorts

Kotlin JDSL has `Sort` interface to represent an order-by item in JPQL. To build `Sort`, you can use `asc()` and `desc()` after [`Expression`](/docs/jpql-with-kotlin-jdsl/expressions.md).

```kotlin
path(Book::isbn).asc()

path(Book::isbn).desc()
```

## Null order

Calling `nullsFirst()` or `nullsLast()` on `Sort` allows to specify where null values appear in an ordered result.

```kotlin
path(Employee::nickname).asc().nullsFirst()

path(Employee::nickname).asc().nullsLast()
```
