查询语句类型Query statement types

查询包含一个或多个“查询语句”,用分号 (;) 分隔。A query consists of one or more query statements, delimited by a semicolon (;). 其中至少有一个查询语句必须是表格表达式语句At least one of these query statements must be a tabular expression statement. 表格表达式语句会生成一个或多个表格结果。The tabular expression statement generates one or more tabular results. 当查询包含多个表格表达式语句时,查询将有一表格表达式语句,且这些语句生成的表格结果都由查询返回。When the query has more than one tabular expression statement, the query has a batch of tabular expression statements, and the tabular results generated by these statements are all returned by the query.

两种类型的查询语句:Two types of query statements:

  • 主要由用户使用的语句(用户查询语句),Statements that are primarily used by users (user query statements),
  • 为支持这样的场景而设计的语句:中间层应用程序接受用户查询并将修改后的版本发送到 Kusto(应用程序查询语句)。Statements that have been designed to support scenarios in which mid-tier applications take user queries and send a modified version of them to Kusto (application query statements).

在这两种情况下,某些查询语句非常有用。Some query statements are useful in both scenarios.

备注

查询语句的“效果”从该语句出现在查询中时开始,到查询结束时结束。The "effect" of a query statement starts at the point where the statement appears in the query and ends at the end of the query. 查询完成后,将释放其所有资源,且查询不会影响以后的查询(除副作用外,比如将查询记录在所有查询的日志中或缓存查询结果。)Once the query completes, all its resources are released and it has no impact on future queries (other than side-effects, such as having the query recorded in a log of all queries run, or having its results cached.)

用户查询语句User query statements

下面是用户查询语句的列表:Following is a list of user query statements:

  • let 语句定义名称和表达式之间的绑定。A let statement defines a binding between a name and an expression. let 语句可用于将较长的查询分解为更易于理解的小型命名部分。Let statements can be used to break a long query into small named parts that are easier to understand.

  • set 语句设置查询选项,该选项会影响查询的处理方式及其返回的结果。A set statement sets a query option that affects how the query is processed and its results returned.

  • 语句是最重要的查询语句,会返回“有趣的”数据作为结果。A tabular expression statement, the most important query statement, returns the "interesting" data back as results.

应用程序查询语句Application query statements

以下是用户查询语句的列表:Following is a list of application query statements:

  • alias 语句 定义(同一群集或远程群集上)的另一个数据库的别名。An alias statement defines an alias to another database (in the same cluster or on a remote cluster).

  • pattern 语句可由基于 Kusto 构建的应用程序用来向其用户公开查询语言以将其自身注入查询名称解析过程。A pattern statement, which can be used by applications that are built on top of Kusto and expose the query language to their users to inject themselves into the query name resolution process.

  • 语句由基于 Kusto 构建的应用程序用来防范注入式攻击(原理类似于命令参数保护 SQL 免于 SQL 注入攻击。)A query parameters statement, which is used by applications that are built on top of Kusto to protect themselves against injection attacks (similar to how command parameters protect SQL against SQL injection attacks.)

  • restrict 语句由在 Kusto 的顶部构建的应用程序用来将查询限制于 Kusto 中的特定数据子集(包括限制对特定列和记录的访问。)A restrict statement, which is used by applications that are built on top of Kusto to restrict queries to a specific subset of data in Kusto (including restricting access to specific columns and records.)

Azure Monitor 不支持此功能This capability isn't supported in Azure Monitor