Source: https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/table-type/ Documentation version: v5.3.2 # Table types A table type describes tabular data composed of named fields and rows. Each field has a value type. For example, `TABLE {id INT64, name STRING}` describes a table with an `id` field of type `INT64` and a `name` field of type `STRING`. Table types cannot be used as node or edge property types. ## View a table type Use the `typeof()` function to view the type of a table variable: ```` ''' TABLE t TYPED TABLE {id INT64, name STRING} = {id: 10001, name: 'Alice'}, {id: 10002, name: 'Bob'} RETURN typeof(t) AS t_type ''' ```` Return: ```` +-------------------------------+ | t_type | +-------------------------------+ | TABLE {id INT64, name STRING} | +-------------------------------+ ```` The returned type contains the name and value type of each field. ## Table types and table variables A table type describes the structure of tabular data, whereas a table variable stores or refers to the data: ```` TABLE t TYPED TABLE {id INT64, name STRING} ```` In this declaration: - `t` is the table variable. - `TABLE {id INT64, name STRING}` is its table type. - The first `TABLE` keyword introduces the table variable declaration. For the complete declaration syntax, see [Table variables](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/variable-definition/table-variable/). ## Use a table type as a procedure parameter A user-defined procedure (UDP) can accept a table through a parameter declared with `TABLE`: ```` parameter_name TABLE ```` In this syntax, `TABLE` accepts a table variable passed by the caller. For more information, see [CREATE PROCEDURE](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/procedures/create/#parameter_type). ## Usage Table types are mainly used for: - Table variables that store intermediate data or results. - UDP parameters that receive tables. - Data exchanged through `IMPORT` and `EXPORT`. ## Table variables in NebulaGraph Database Developer Edition In NebulaGraph Database Developer Edition, the field names and types of a table variable can also be inferred from an initializer or query result. Local table variables can be iterated with `FOR`. ## Limitations - Table types cannot be used as node or edge property types. - The values written to a table must be compatible with its field types. ## See also - [Table variables](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/variable-definition/table-variable/) - [typeof()](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/fe/functions/system/#typeof) - [IMPORT](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/in-out/import/) - [EXPORT](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/in-out/export/)