Range Operator in Kusto Query Language | Generate Number Sequence or Date Range in Kusto Query Language

Topic: Range Operator in Kusto Query Language (KQL).


In this article, we are going to learn about the range operator, range operator is used to generate a single-column table of values. Kusto Query Language is a powerful tool for exploring your data and discovering patterns, identifying anomalies and outliers, creating statistical modeling, etcfor exploring your data and discovering patterns, identifying anomalies and outliers, creating statistical modeling, single-column The query uses schema entities that are organized in a hierarchy similar to SQL's: databases, tables, and columns.


 //range operator : Generates a single-column table of values.  
 // syntax : range columnName from start to stop step step  
   
 //create sequence no  
 range Steps from 1 to 8 step 1  
   
 //create range of dates  
 range LastWeek from ago(7d) to now() step 1d  
   
   
 //create range of even numbers  
 range Steps from 2 to 100 step 2  
   
   
 //create range of odd numbers  
 range Steps from 1 to 100 step 2  
   
 //Let's create a table Customer  
 //.drop table Customer  
 .create table Customer (CustomerId: long, Name: string)   
  .ingest inline into table Customer <|  
 1,Aamir  
 2,Raza  
 3,Lisa  
 4,steve  
 5,Robert  
   
 //you can use range output in many ways // try to get all records with odd and even CustomerId  
 range CustomerId from 1 to 5 step 2  
 | join kind=inner (Customer ) on $left.CustomerId==$right.CustomerId  
 | project CustomerId,Name  
   
   
   

Video Demo: Range Operator in Kusto Query Language | Generate Number Sequence or Date Range in Kusto Query Language

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.