Query statements
Query statements in KQL produce tables that can be used in other parts of the query and must end with a semicolon (;
). These commands, of which we will only discuss the let
command here, will return entire tables that are all returned by the query. Keep in mind that a table can consist of a single row and a single column, in which case it acts as a constant in other languages.
The let statement
The let
statement allows you to create a new variable that can be used in later computations. It is different than extend
or project
in that it can create more than just a column – it can create another table if desired.
So, if I want to create a table that contains all the StormEvents
for only NORTH CAROLINA
, I can use the following commands. Note the ;
at the end of the let
statement since it is indeed a separate statement:
let NCEvents = StormEvents | where State == "NORTH CAROLINA"; NCEvents
The let
statement can also be used to define constants...