From 841f75f9121da0d49e9712f231e8702094e29a2a Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Mon, 1 Jan 2024 23:25:40 -0500 Subject: [PATCH] vault backup: 2024-01-01 23:25:40 --- Databases/SurrealDB/Syntax.md | 15 +++++++++++++++ Projects/omega/general.md | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) 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