Vertex Table Management
This document describes how to manage vertex tables in the database system. A vertex table represents nodes in a graph database and contains the properties associated with those nodes.
Overview
Vertex tables are fundamental building blocks in graph databases. They store node data with defined properties and constraints.
Each vertex table requires a primary key to uniquely identify vertices. Multiple columns can be combined to form a composite primary key.
Create Vertex Table
Create vertex table with given name.
Syntax
CREATE VERTEX <vertex_table_name>
(
<column_name> <data_type> [NOT NULL | NULL ],
<column_name> <data_type> ...
...
)
PRIMARY KEY <column_name> | ( <column_name>, ... )
Example
Create a vertex table named Person, has three columns, namely col1
, col2
and
col3
. And requires col1
has an NOT NULL constraint.
CREATE VERTEX Person
(
col1 BIGINT NOT NULL,
col2 VARCHAR,
col3 VARCHAR
)
PRIMARY KEY col1
Drop Vertex Table
Drop a vertex table with given name.
Syntax
DROP VERTEX <vertex_table_name>
Example
DROP VERTEX Person
Describe Vertex Table
Describe meta information about a vertex table
Syntax
DESCRIBE VERTEX <vertex_table_name>
Example
DESCRIBE VERTEX Person
List Vertex Tables
List all vertex table names.
Syntax
LIST VERTEX
Rename Columm Name
Rename table column if both table and column exists.
ALTER TABLE [IF EXISTS] <table_name>
RENAME COLUMN [IF EXISTS] <column_name> TO <new_column_name>
Example
ALTER TABLE Person RENAME COLUMN age To new_age