Tables

表是用于保存数据的命名实体。Tables are named entities that hold data. 表具有一组有序以及零个或零个以上的数据行。A table has an ordered set of columns, and zero or more rows of data. 每一行为表的每个列保存一个数据值。Each row holds one data value for each of the columns of the table. 表中的行顺序是未知的,除了某些本身不确定的表格运算符(例如 top 运算符)外,一般不会影响查询。The order of rows in the table is unknown, and doesn't in general affect queries, except for some tabular operators (such as the top operator) that are inherently undetermined.

表与存储函数占用相同的命名空间。Tables occupy the same namespace as stored functions. 如果存储函数与表同名,则会选择存储函数。If a stored function and a table both have the same name, the stored function will be chosen.

说明Notes

  • 表名区分大小写。Table names are case-sensitive.
  • 表名必须遵循实体名称的规则。Table names follow the rules for entity names.
  • 每个数据库的表数量上限为 10,000。Maximum limit of tables per database is 10,000.

有关如何创建和管理表的详细信息,可参阅管理表Details on how to create and manage tables can be found under managing tables

表引用Table References

引用表的最简单方法是使用其名称。The simplest way to reference a table is by using its name. 可对上下文中数据库内的所有表执行此引用。This reference can be done for all tables that are in the database in context. 例如,下面的查询将计算当前数据库的 StormEvents 表的记录数:For example, the following query counts the records of the current database's StormEvents table:

StormEvents
| count

编写上述查询的等效方法是转义表名:An equivalent way to write the query above is by escaping the table name:

["StormEvents"]
| count

还可以通过显式注明表所在的数据库(或数据库和群集)来引用表。Tables may also be referenced by explicitly noting the database (or database and cluster) they are in. 然后,可以创建合并多个数据库和群集中的数据的查询。Then you can author queries that combine data from multiple databases and clusters. 例如,只要调用方有权访问目标数据库,下面的查询就可用于上下文中的任何数据库:For example, the following query will work with any database in context, as long as the caller has access to the target database:

cluster("https://help.kusto.chinacloudapi.cn").database("Samples").StormEvents
| count

也可以通过使用 table() 特殊函数来引用表,只要该函数的参数计算结果是一个常量。It's also possible to reference a table by using the table() special function, as long as the argument to that function evaluates to a constant. 例如:For example:

let counter=(TableName:string) { table(TableName) | count };
counter("StormEvents")

备注

使用 table() 特殊函数显式指定表数据范围。Use the table() special function to explicitly specify the table data scope. 例如,使用此函数可将处理限制为位于热缓存的表中的数据。For example, use this function to restrict processing to the data in the table that falls in the hot cache.