CREATE TABLE (SQL Graph)
defines a graph node/edge table (adds $node_id or $edge_id/$from_id/$to_id)
What changes
- Input
- column definitions with AS NODE or AS EDGE
- Output or change
- node or edge table
Syntax at a glance
CREATE TABLE { database_name.schema_name.table_name | schema_name.table_name | table_name } ( { <column_definition> } | <computed_column_definition> | <column_set_definition> | [ <table_constraint> ] [ ,... n ] | [ <table_index> ] } [ ,...n ] ) AS [ NODE | EDGE ] [ ON { partition_scheme_name ( partition_column_name ) | filegroup | "default" } ] [ ; ]
Work example
A relationship model needs node and edge tables for graph queries.
In a lab, map each node identity and edge direction to the graph traversal the application needs.
Check your work A test edge connects the intended node types and the graph query returns that path.
Open Microsoft Learn for full syntax, permissions, and details for your version.