take / limit
take N returns up to N rows. limit is another name for it.
SigninLogs
| take 10
Its main use is exploring: when you meet a new table, take 10 shows its columns and some real values
without scanning everything.
No order guaranteed
take returns some rows, not the first, latest or largest ones. On a real cluster, running the same
query twice can return different rows. Even after a sort by, use top if you want “the
first N in this order”; it says what you mean.
That is also why answers built on take can’t be checked: on this site the exercises never need
take, and the grader compares complete results.
Things to know
- If the table has fewer than
Nrows, you get them all. - In Microsoft Sentinel and Defender advanced hunting, the portal also caps how many rows it shows. That
is a display limit, separate from
take.
Examples
SecurityEvent
| take 5A quick way to see the columns and what typical values look like.
DeviceNetworkEvents
| where RemotePort == 123
| limit 3Practice it
None of the free exercises needs this one yet.