@@ -3,6 +3,7 @@ sidebar_position: 3
33---
44
55import InlineCodeBlock from ' @site/src/components/InlineCodeBlock' ;
6+ import BrowserOnly from ' @docusaurus/BrowserOnly' ;
67
78# Interactive Queries
89
@@ -14,61 +15,72 @@ Learn how to query data in ReifyDB with interactive examples. You can run these
1415
1516The most fundamental query in ReifyDB is the SELECT statement. Try running this query to see all users:
1617
17- <InlineCodeBlock query = " map {1}" />
18+ <BrowserOnly fallback = { <div >Loading editor...</div >} >
19+ { () => <InlineCodeBlock query = " map {1}" />}
20+ </BrowserOnly >
1821
1922### Filtering with WHERE
2023
2124You can filter results using the WHERE clause:
2225
23- <InlineCodeBlock
24- query = " SELECT name, email
26+ <BrowserOnly fallback = { <div >Loading editor...</div >} >
27+ { () => <InlineCodeBlock
28+ query = " SELECT name, email
2529FROM users
2630WHERE email LIKE '%@example.com'"
27- />
31+ />}
32+ </BrowserOnly >
2833
2934## Joining Tables
3035
3136ReifyDB supports various types of joins to combine data from multiple tables:
3237
33- <InlineCodeBlock
34- query = " SELECT u.name, p.title
38+ <BrowserOnly fallback = { <div >Loading editor...</div >} >
39+ { () => <InlineCodeBlock
40+ query = " SELECT u.name, p.title
3541FROM users u
3642JOIN posts p ON u.id = p.user_id
3743WHERE p.published = true"
38- />
44+ />}
45+ </BrowserOnly >
3946
4047## Aggregation
4148
4249Use aggregation functions to summarize your data:
4350
44- <InlineCodeBlock
45- query = " SELECT u.name, COUNT(p.id) as post_count
51+ <BrowserOnly fallback = { <div >Loading editor...</div >} >
52+ { () => <InlineCodeBlock
53+ query = " SELECT u.name, COUNT(p.id) as post_count
4654FROM users u
4755LEFT JOIN posts p ON u.id = p.user_id
4856GROUP BY u.id, u.name
4957ORDER BY post_count DESC"
50- />
58+ />}
59+ </BrowserOnly >
5160
5261## Conditional Logic
5362
5463ReifyDB supports CASE statements for conditional logic:
5564
56- <InlineCodeBlock
57- query = " SELECT
65+ <BrowserOnly fallback = { <div >Loading editor...</div >} >
66+ { () => <InlineCodeBlock
67+ query = " SELECT
5868 title,
5969 CASE
6070 WHEN published = true THEN 'Published'
6171 ELSE 'Draft'
6272 END as status
6373FROM posts"
64- />
74+ />}
75+ </BrowserOnly >
6576
6677## Multiple Statements
6778
6879You can run multiple SQL statements in a single execution. Each statement produces its own result table:
6980
70- <InlineCodeBlock
71- query = { ` -- Get all users
81+ <BrowserOnly fallback = { <div >Loading editor...</div >} >
82+ { () => <InlineCodeBlock
83+ query = { ` -- Get all users
7284SELECT * FROM users;
7385
7486 -- Get all published posts
@@ -81,7 +93,8 @@ SELECT * FROM users;
8193 FROM users u
8294 LEFT JOIN posts p ON u.id = p.user_id
8395 GROUP BY u.id, u.name; ` }
84- />
96+ />}
97+ </BrowserOnly >
8598
8699## Try Your Own Queries
87100
0 commit comments