vault backup: 2024-01-01 23:10:40
This commit is contained in:
@@ -34,3 +34,4 @@ The HTTP protocol must be used in the export process
|
||||
## SQL mode
|
||||
|
||||
SurrealDB has a SQL-like (not compatible with ANSI SQL) language one can use for running (or piping) SurrealQL queries. You can find the syntax and some examples over [here](./Syntax).
|
||||
|
||||
|
@@ -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'];
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user