Skip to content

Instantly share code, notes, and snippets.

@gramian
Last active February 18, 2024 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gramian/7dc306ede8582a6fb12d5dabd7e1328f to your computer and use it in GitHub Desktop.
Save gramian/7dc306ede8582a6fb12d5dabd7e1328f to your computer and use it in GitHub Desktop.
ArcadeDB SQL Cheat Sheet | build: pandoc arcadedb-cheatsheet.md -f markdown -o arcadedb-sql.pdf -V geometry:margin=1.5cm,landscape -V pagestyle=empty -V colorlinks=true

ArcadeDB SQL Cheat Sheet

CRUD

INSERT INTO <type>|BUCKET:<bucket>|<index> [(<field>[,]*) VALUES (<expression>[,]*)[,]*]|
$~~~~~~~~~~~~~~~~~~~$[SET <field> = <expression>|<command>[,]*]|[CONTENT {<json>}] [RETURN <expression>] [FROM <query>]

SELECT [<projections>] [FROM <target> [LET <assignment>*]] [WHERE <condition>*] [GROUP BY <field>*] [ORDER BY <fields>* [ASC|DESC]*]
$~~~~~~~~~~~$[UNWIND <Field>*] [SKIP <number>] [LIMIT <max>] [TIMEOUT <ms> [<strategy>]]

UPDATE <type>|BUCKET:<bucket>|<RID> [SET|REMOVE <field> = <value>[,]*]|[CONTENT|MERGE <json>] [UPSERT] [RETURN <returning> [<expression>]]
$~~~~~~~~~~~$[WHERE <condition>] [LIMIT <max>] [TIMEOUT <ms>]

DELETE FROM <type>|BUCKET:<bucket>|<index> [RETURN <returning>] [WHERE <condition>*] [LIMIT <max>] [TIMEOUT <ms>]

Graphs

MATCH <pattern> [,[NOT] <pattern>]* RETURN [DISTINCT] <expression> [AS <alias>] [,<expression> [AS <alias>]]*
$~~~~~~~~~~$GROUP BY <expression>[,]* ORDER BY <expression>[,]* SKIP <number> LIMIT <max>

TRAVERSE [<type.]field>|*|any()|all() [FROM <target>] [MAXDEPTH <number>|WHILE <condition>] [LIMIT <max>] [STRATEGY <strategy>]

CREATE VERTEX [<type>] [BUCKET <bucket>] [SET <field> = <expression>[,]*]

CREATE EDGE <type> [BUCKET <bucket>] [UPSERT] FROM <rid>|(<query>)|[<rid>]* TO <rid>|(<query>)|[<rid>]* [IF NOT EXISTS]
$~~~~~~~~~~~~~~~~~~~$[SET <field> = <expression>[,]*]|CONTENT {<json>} [RETRY <retry> [WAIT <ms>]] [BATCH <batch-size>]

Types

CREATE <DOCUMENT|VERTEX|EDGE> TYPE <type> [IF NOT EXISTS] [EXTENDS <type>] [BUCKET <bucket>[,]*] [BUCKETS <number>]

ALTER TYPE <type> [<attribute> <value>] [CUSTOM <key> <value>]

TRUNCATE TYPE <type> [POLYMORPHIC] [UNSAFE]

DROP TYPE <type> [UNSAFE] [IF EXISTS]

Buckets

CREATE BUCKET <bucket> [ID <bucket-id>]

TRUNCATE BUCKET <bucket>

DROP BUCKET <bucket>|<bucket-id>

Properties

CREATE PROPERTY <type>.<property> <data-type> [<constraint>[,]*] [IF NOT EXISTS]

ALTER PROPERTY <type>.<property> <attribute> <value> [CUSTOM <custom-key> = <custom-value>]

DROP PROPERTY <type>.<property> [FORCE]

Indices

CREATE INDEX [<name>] [IF NOT EXISTS] [ON <type> (<property>[,]*)] <UNIQUE|NOTUNIQUE|FULL_TEXT> [<key-type>] [NULL_STRATEGY SKIP|ERROR]

REBUILD INDEX <name>

DROP INDEX <name> [IF EXISTS]

Database

ALTER DATABASE <setting> <value>

IMPORT DATABASE <url> [WITH (<setting-name> = <setting-value> [,])*]

EXPORT DATABASE <url> [FORMAT JSONL|GRAPHML|GRAPHSON] [OVERWRITE TRUE|FALSE]

BACKUP DATABASE [<url>]

ALIGN DATABASE

CHECK DATABASE [TYPE <type>[,]*] [BUCKET <bucket>[,]*] [FIX]

Analysis

EXPLAIN <command>

PROFILE <command>

System

CONSOLE .<logLevel> <expression>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment