Skip to content

Commit 12138dc

Browse files
TimelordUKclaude
andcommitted
docs: Move WEB CTE temp tables test to examples with ABS demo
Moved integration test to examples/ and enhanced with ABS function demonstration. Example now shows: 1. Fetch data from Flask API into temp table 2. Basic statistics (COUNT, MIN, MAX, SUM) 3. GROUP BY with aggregations 4. Computed columns with ABS() function 5. ORDER BY using computed column alias Key features demonstrated: - WEB CTE with temp table creation (INTO clause) - Dependency-aware execution with --execute-statement - ABS() function for absolute values - ORDER BY with column alias (workaround for expression limitation) Usage: # Run all statements ./target/release/sql-cli -f examples/cte_flask_dependency.sql # Run specific statement with dependencies ./target/release/sql-cli -f examples/cte_flask_dependency.sql --execute-statement 4 # In Neovim: \sq (all) or \sx (statement at cursor) Note: ORDER BY doesn't support expressions directly, but you can use computed column aliases: SELECT expr as alias ... ORDER BY alias 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bba73e2 commit 12138dc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

integration_tests/test_web_cte_temp_tables.sql renamed to examples/cte_flask_dependency.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ ORDER BY trade_count DESC
4444
LIMIT 10;
4545
GO
4646

47-
-- Stage 4: Find largest trades by quantity
47+
-- Stage 4: Calculate absolute notional values and find largest
4848
SELECT
4949
Source,
5050
BloomberTicker,
5151
BuySell,
5252
SignedQuantity,
53-
Price
53+
Price,
54+
(SignedQuantity * Price) as notional_value,
55+
ABS(SignedQuantity * Price) as abs_notional
5456
FROM #bloomberg_trades
55-
ORDER BY SignedQuantity DESC
56-
LIMIT 5;
57+
ORDER BY abs_notional DESC
58+
LIMIT 10;
5759
GO

0 commit comments

Comments
 (0)