> For the complete documentation index, see [llms.txt](https://digitalgarden.batamladen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://digitalgarden.batamladen.com/notes/query-languages/kql/pipes-or-where-or-take.md).

# pipes | where | take

### pipes

Basic as it is, pipes are used in every query language.

Pipes take the output of the previous command and serve it as input in the next command.

#### Example

```
Table Name
| first command
| second command
```

The goal it to narrow our search to exactly what we need.

***

### where

The where command is used to select entry's from specific fields.

#### Example

Customers table:

<figure><img src="/files/SlWyPNhwTOW3TzI5hhmJ" alt=""><figcaption></figcaption></figure>

The table has 18000+ records.

If we want to search for customers that have the name 'Peter' and are from 'Europe' we would use the where command with the 'First name' and the 'ContinentName' fields.

```kql
Customers
| where FirstName == "Peter"
| where ContinentName == "Europe"
```

<figure><img src="/files/TPYcu6S0AsiGb4XsbXxp" alt=""><figcaption></figcaption></figure>

***

### take

Nothing special of a command, just takes the amount of rows you specify.

#### Example

```
Customers
| take 10
```

This takes the first 10 rows of the 'Customers' table.

***

### Different Data Bases

If we use one database, we can specify all the tables that we want in that db.

But if we have a second db and we want to search a table from there? We can specify it like this:

```
cluster('cluster name').database('db name').table('table name')
| normal piped commands
```

#### Example

If we have a few queries for the 'ContosoSales' db, and want to search smth from the 'Samples' db as well, we can do it like this:

```
cluster('help').database('Samples').table('PopulationData')
| where State == "ARKANSAS"
```

Just specify the exact 'path' that leads to the table you want and thats it, the pipe commands below are syntax'd the same as always.

<figure><img src="/files/Bb8L6aZEGHOe5z8eO4KP" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://digitalgarden.batamladen.com/notes/query-languages/kql/pipes-or-where-or-take.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
