Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ CREATE QUERY update_ex() FOR GRAPH Work_Net {

UPDATE s FROM S:s
SET s.location_id = "USA", // simple base type attribute
s.skill_list = [1,2,3] // collection-type attribute
s.skill_list = [1,2,3], // list-type attribute
s.skill_set = (1,2,3), // set-type attribute
s.skill_map = ("a"->1, "b"->2) // map-type attribute
WHERE s.location_id == "us";

// The update cannot become effective within this query, so PRINT S still show "us".
// The update cannot become effective within this query, so PRINT S still shows "us".
PRINT S;
}
}
3 changes: 3 additions & 0 deletions modules/querying/pages/data-modification-statements.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ The optional `WHERE` clause supports boolean conditions to filter the items in t
[discrete]
=== Examples

When updating collection-type attributes, note the syntax differences:
use `[]` for list-type, `()` for set-type, and `->` for map-type attributes.

.`UPDATE` statement example
[source.wrap,gsql]
----
Expand Down