Topic: How to Create Single or Multiple Tables in a Single Statement by Using KUSTO Query.
How to create single or multiple tables in a single file statement by using Kusto Query | Kusto Query Language Tutorial (KQL) Kusto Query Language is a powerful tool to explore your data and discover patterns, identify anomalies and outliers, create statistical modeling, and more. The query uses schema entities that are organized in a hierarchy similar to SQL's: databases, tables, and columns. A Kusto query is a read-only request to process data and return results. The request is stated in plain text, using a data-flow model that is easy to read, author, and automate. Kusto queries are made of one or more query statements.
//.create-merge table
// This can be used to create new table. If table does exists then it will add the new columns if specified columns already
// does not exist in the table. If you will specify a column with the different data type, then the command will fail. this commend does not
// drop columns if not mentioned in column list.
.create-merge table Customer(CustomerId:int ,CustomerName:string,
CustomerAddress:string,
Age:int)
with (docstring="this is Customer Table",folder ="CustomerData")
//Let's check the definition of table
.show table Customer schema as json
// add one row data
.ingest inline into table Customer <|
100,Aamir,SomeAddress,43
// check data
Customer
// let's rerun and add one more column, phonenumber:string, add add new docstring and move to new folder
.create-merge table Customer(
CustomerId:int ,
CustomerName:string,
CustomerAddress:string,
Age:int,
phonenumber:string)
with (docstring="Customer table new definition",folder ="CustomerData1")
//Let's check the definition of table
.show table Customer schema as json
// Show list of tables
.show tables
// check the data
Customer
//.create-merge tables : Let you create multiple table in single command
.create-merge tables
CustomerAsia (Name:string, dob:datetime, UserId:string),
CustomerEurope (Name:string, dob:datetime, UserId:string,Region:string)
//check all tables
.show tables