vault backup: 2024-01-01 23:10:40

This commit is contained in:
2024-01-01 23:10:40 -05:00
parent a59f99183c
commit e5b35dae0a
2 changed files with 19 additions and 2 deletions

View File

@@ -74,4 +74,20 @@ SELECT ->likes->friend.name AS friends FROM person:tobie;
-- Use the result of a subquery as a returned field
SELECT *, (SELECT * FROM events WHERE type = 'activity' LIMIT 5) AS history FROM user;
```
### `UPDATE`
### `UPDATE` examples
```SQL
-- Update all records in a table
UPDATE person SET skills += ['breathing'];
-- Update or create a record with a specific numeric id
UPDATE person:100 SET name = 'Tobie', company = 'SurrealDB', skills = ['Rust', 'Go', 'JavaScript'];
-- Update or create a record with a specific string id
UPDATE person:tobie SET name = 'Tobie', company = 'SurrealDB', skills = ['Rust', 'Go', 'JavaScript'];
-- Update just a single record
-- Using the ONLY keyword, just an object for the record in question will be returned.
-- This, instead of an array with a single object.
UPDATE ONLY person:tobie SET name = 'Tobie', company = 'SurrealDB', skills = ['Rust', 'Go', 'JavaScript'];
```