https://cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax?hl=en#nested-updates-protocol-buffers
UPDATE Singers s
SET
(DELETE FROM s.SingerInfo.Residence r WHERE r.City = 'Seattle'),
(UPDATE s.SingerInfo.Residence r SET r.end_year = 2015 WHERE r.City = 'Eugene'),
(INSERT s.Albums.Song VALUES ("songtitle: 'The Second Best Song'"))
WHERE SingerId = 3 AND s.Albums.title = 'Go! Go! Go!';
Note
The formal syntax is not yet well described in the Spanner DML syntax reference, but we can reference ZetaSQL DML syntax reference.
https://github.com/google/zetasql/blob/2024.11.1/docs/data-manipulation-language.md#update-statement
UPDATE target_name
SET set_clause
[FROM from_clause]
WHERE condition [ASSERT_ROWS_MODIFIED n] [ then_return_clause ]
set_clause:
update_item[, ...]
update_item:
{
path_expression = expression
| path_expression = DEFAULT
| (dml_stmt)
}
...
dml_stmt:
{ insert_statement | update_statement | delete_statement }
https://cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax?hl=en#nested-updates-protocol-buffers
Note
The formal syntax is not yet well described in the Spanner DML syntax reference, but we can reference ZetaSQL DML syntax reference.
https://github.com/google/zetasql/blob/2024.11.1/docs/data-manipulation-language.md#update-statement