你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Applies to: ✅Microsoft Fabric✅Azure Data Explorer✅Azure Monitor✅Microsoft Sentinel
表格表达式语句是人们在谈论查询时通常会想到的内容。 此语句通常出现在语句列表的最后,其输入和输出都由表或表格数据集组成。 必须用分号分隔任意两个语句。
表格表达式语句的典型结构由以下部分构成:表格数据源(如表格)、表格数据运算符(如筛选器和投影),可能还包括呈现运算符。 组合用管道字符 (|) 表示,为语句提供了一种规则形式,从左到右直观显示表格数据流。
每个运算符都接受“来自管道”的表格数据集以及其他输入(包括来自运算符主体的更多表格数据集),然后将表格数据集发送给随后的下一个运算符。
Syntax
Source|Operator1|Operator2|RenderInstruction
Learn more about syntax conventions.
Parameters
| Name | 类型 | Required | Description |
|---|---|---|---|
| Source | string |
✔️ | 表格数据源。 请参阅表格数据源。 |
| Operator | string |
✔️ | 表格数据运算符,例如筛选器和投影。 |
| RenderInstruction | string |
呈现运算符或说明。 |
表格数据源
表格数据源生成记录集,以便由表格数据运算符进一步处理 。 以下列表显示了支持的表格数据源:
- Table references
- The tabular range operator
- The print operator
- 返回表的函数的调用
- A table literal ("datatable")
Examples
本节中的示例演示如何使用语法帮助你入门。
The examples in this article use publicly available tables in the help cluster, such as the
StormEventstable in the Samples database.
The examples in this article use publicly available tables, such as the
Weathertable in the Weather analytics sample gallery. 可能需要修改示例查询中的表名称以匹配工作区中的表。
按条件筛选行
此查询计算 StormEvents 表中具有 State 列中值“FLORIDA”的记录数。
StormEvents
| where State == "FLORIDA"
| count
Output
| Count |
|---|
| 1042 |
组合两个表中的数据
In this example, the join operator is used to combine records from two tabular data sources: the StormEvents table and the PopulationData table.
StormEvents
| where InjuriesDirect + InjuriesIndirect > 50
| join (PopulationData) on State
| project State, Population, TotalInjuries = InjuriesDirect + InjuriesIndirect
Output
| State | Population | TotalInjuries |
|---|---|---|
| ALABAMA | 4918690 | 60 |
| CALIFORNIA | 39562900 | 61 |
| KANSAS | 2915270 | 63 |
| MISSOURI | 6153230 | 422 |
| OKLAHOMA | 3973710 | 200 |
| TENNESSEE | 6886720 | 187 |
| TEXAS | 29363100 | 137 |