diff --git a/Databases/SurrealDB/Syntax.md b/Databases/SurrealDB/Syntax.md index 3df8bc8..1d6b97d 100644 --- a/Databases/SurrealDB/Syntax.md +++ b/Databases/SurrealDB/Syntax.md @@ -83,7 +83,22 @@ SELECT *, (SELECT * FROM events WHERE type = 'activity' LIMIT 5) AS history FROM ### Multiple targets with `FROM` ```SQL +-- This command selects all records from both 'user' and 'admin' tables. +SELECT * FROM user, admin; +-- This command selects all records from the table named in the variable '$table', +-- but only if the 'admin' field of those records is true. +-- This query is equivalent to 'SELECT * FROM user WHERE admin = true'. +LET $table = "user"; +SELECT * FROM type::table($table) WHERE admin = true; + +-- This command selects a single record from: +-- * the table named in the variable '$table', +-- * and the identifier named in the variable '$id'. +-- This query is equivalent to 'SELECT * FROM user:admin'. +LET $table = "user"; +LET $id = "admin"; +SELECT * FROM type::thing($table, $id); ``` ### `UPDATE` examples diff --git a/Projects/omega/general.md b/Projects/omega/general.md index dd4f1a0..95f03cf 100644 --- a/Projects/omega/general.md +++ b/Projects/omega/general.md @@ -4,4 +4,4 @@ - soundcloud - spotfy - apple music -- data stored in [surrealdb](obsidian://open?vault=Miller%20Knowledgebase&file=Databases%2FSurrealDB%2FSurrealDB%20Local%20Setup) \ No newline at end of file +- data stored in [[SurrealDB Local Setup]] \ No newline at end of file