Skip to content

Commit

Permalink
Merge pull request #219 from gramian/main
Browse files Browse the repository at this point in the history
Minor SQL update
  • Loading branch information
lvca authored Nov 20, 2023
2 parents ad9040c + 9e09002 commit faf3292
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/main/asciidoc/appendix/sql-syntax.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -362,20 +362,19 @@ The conversion of a number to BigDecimal can be done explicitly, using the `bigD
[[SQL-Collections]]
**Collections**

ArcadeDB supports two types of collections:
ArcadeDB supports one type of collection:

- **Lists**: ordered, allow duplicates
- **Sets**: not ordered (?), no duplicates
The SQL notation allows to create `Lists` with square bracket notation, eg.
```
[1, 3, 2, 2, 4]
```

A `List` can be converted to a `Set` using the `.asSet()` method:
For OrientDB compatibility, the `.asSet()` method is available to remove duplicates from a `List`:

```
[1, 3, 2, 2, 4].asSet() = [1, 3, 2, 4] /* the order of the elements in the resulting set is not guaranteed */
[1, 3, 2, 2, 4].asSet() = [1, 3, 2, 4] -- The order of the elements in the resulting set is not guaranteed
```

[[SQL-Binary]]
Expand Down
2 changes: 1 addition & 1 deletion src/main/asciidoc/sql/SQL-Drop-Index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DROP INDEX <index-name> [ IF EXISTS ]

[source,sql]
----
ArcadeDB> DROP INDEX `Users.Id`
ArcadeDB> DROP INDEX `Users[Id]`
----

For more information, see:
Expand Down
3 changes: 3 additions & 0 deletions src/main/asciidoc/sql/SQL-Script.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ SQL Batch supports all the ArcadeDB <<SQL-Commands,SQL Commands>>, plus the foll
** `&lt;retry&gt;` is the number of retries in case of concurrent modification exception
* `ROLLBACK`
* `LET &lt;variable&gt; = &lt;SQL&gt;`, to assign the result of a SQL command to a variable. To reuse the variable prefix it with the dollar sign `$`.

NOTE: A `LET` can be used as an ephemeral https://en.wikipedia.org/wiki/View_(SQL)[view].

* `IF(&lt;condition&gt;){ &lt;statememt&gt;; [&lt;statement&gt;;]* }`. Look at <<Conditional-Execution,conditional execution>>.
* `WHILE(&lt;condition&gt;){ &lt;statememt&gt;; [&lt;statement&gt;;]* }`. Look at <<Loops,loop>>.
* `FOREACH(&lt;variable&gt; IN &lt;expression&gt;){ &lt;statememt&gt;; [&lt;statement&gt;;]* }`. Look at <<Loops,loops>>.
Expand Down
6 changes: 6 additions & 0 deletions src/main/asciidoc/sql/SQL-Update.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ Remove an element from a list or set of strings:
ArcadeDB> UPDATE Account REMOVE addresses = 'Foo'
----

Append an element to a list or set of strings:

----
ArcadeDB> UPDATE Account SET addresses += 'Foo'
----

* Update to remove a value, filtering on value attributes.

Remove addresses based in the city of Rome:
Expand Down

0 comments on commit faf3292

Please sign in to comment.