- OrientDB - Console Modes
- OrientDB - Data Types
- OrientDB - Basic Concepts
- OrientDB - Installation
- OrientDB - Overview
- OrientDB - Home
OrientDB Database Commands
- OrientDB - Drop Database
- OrientDB - Optimize Database
- OrientDB - Rollback Database
- OrientDB - Commit Database
- OrientDB - Import Database
- OrientDB - Export Database
- OrientDB - Config Database
- OrientDB - Release Database
- OrientDB - Freeze Database
- OrientDB - List Database
- OrientDB - Info Database
- OrientDB - Disconnect Database
- OrientDB - Connect Database
- OrientDB - Restore Database
- OrientDB - Backup Database
- OrientDB - Alter Database
- OrientDB - Create Database
OrientDB Record Commands
- OrientDB - Delete Record
- OrientDB - Truncate Record
- OrientDB - Update Record
- OrientDB - Export Record
- OrientDB - Reload Record
- OrientDB - Load Record
- OrientDB - Display Records
- OrientDB - Insert Record
OrientDB Class Commands
OrientDB Cluster Commands
- OrientDB - Drop Cluster
- OrientDB - Truncate Cluster
- OrientDB - Alter Cluster
- OrientDB - Create Cluster
OrientDB Property Commands
OrientDB Vertex Commands
OrientDB Edge Commands
OrientDB Advanced Concepts
- OrientDB - Studio
- OrientDB - Security
- OrientDB - Upgrading
- OrientDB - Performance Tuning
- OrientDB - Logging
- OrientDB - Caching
- OrientDB - Hooks
- OrientDB - Transactions
- OrientDB - Indexes
- OrientDB - Sequences
- OrientDB - Functions
OrientDB Interfaces
OrientDB Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
OrientDB - Create Vertex
OrientDB database is not only a Document database but also a Graph database. New concepts such as Vertex and Edge are used to store the data in the form of graph. It apppes polymorphism on vertices. The base class for Vertex is V.
In this chapter you can learn how to create vertex to store graph data.
The following statement is the basic syntax of Create Vertex Command.
CREATE VERTEX [<class>] [CLUSTER <cluster>] [SET <field> = <expression>[,]*]
Following are the details about the options in the above syntax.
<class> − Defines the class to which the vertex belongs.
<cluster> − Defines the cluster in which it stores the vertex.
<field> − Defines the field you want to set.
<expression> − Defines the express to set for the field.
Example
Try the following example to understand how to create vertex.
Execute the following query to create a vertex without ‘name’ and on the base class V.
orientdb> CREATE VERTEX
If the above query is executed successfully, you will get the following output.
Created vertex V#9:0 v1 in 0.118000 sec(s)
Execute the following query to create a new vertex class named v1, then create vertex in that class.
orientdb> CREATE CLASS V1 EXTENDS V orientdb> CREATE VERTEX V1
If the above query is executed successfully, you will get the following output.
Created vertex V1#14:0 v1 in 0.004000 sec(s)
Execute the following query to create a new vertex of the class named v1, defining its properties such as brand = Maruti and name = Swift .
orientdb> CREATE VERTEX V1 SET brand = maruti , name = swift
If the above query is executed successfully, you will get the following output.
Created vertex V1#14:1{brand:maruti,name:swift} v1 in 0.004000 sec(s)Advertisements