Marketplace sql-queries
Expert SQL query generation for DBX Studio. Use when writing, optimizing, or debugging SQL queries against user database connections.
install
source · Clone the upstream repo
git clone https://github.com/aiskillstore/marketplace
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/aiskillstore/marketplace "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/dbxstudio/sql-queries" ~/.claude/skills/aiskillstore-marketplace-sql-queries && rm -rf "$T"
manifest:
skills/dbxstudio/sql-queries/SKILL.mdsource content
SQL Query Expert — DBX Studio
This project supports multiple database backends via user connections. Always write dialect-appropriate SQL.
Supported Dialects
| Dialect | Provider |
|---|---|
| PostgreSQL | Default / Railway |
| Snowflake | Via MCP connector |
| BigQuery | Via MCP connector |
| Databricks | Via MCP connector |
| MySQL | Via connection string |
| SQLite | Via connection string |
Query Patterns
Safe SELECT with limit
Always add LIMIT unless the user explicitly wants all rows:
SELECT * FROM "schema"."table" LIMIT 100;
CTEs for complex queries
WITH ranked AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY category ORDER BY created_at DESC) AS rn FROM orders ) SELECT * FROM ranked WHERE rn = 1;
Aggregations
SELECT DATE_TRUNC('month', created_at) AS month, COUNT(*) AS total, SUM(amount) AS revenue FROM orders GROUP BY 1 ORDER BY 1 DESC;
Window Functions
SELECT user_id, amount, SUM(amount) OVER (PARTITION BY user_id ORDER BY created_at) AS running_total FROM transactions;
Tool Usage in DBX Studio AI
The AI has access to these tools — always use them rather than guessing:
| Tool | When to Use |
|---|---|
| First call — understand table structure |
| Preview rows before writing complex queries |
| Run SELECT queries (SELECT/WITH only) |
| Get column details, FK relationships |
| Row counts, distributions |
| Visualize query results |
Query Safety Rules
- Only SELECT and WITH (CTEs) are permitted via
execute_query - Always quote identifiers:
"schema"."table"."column" - Add LIMIT automatically unless the user asks for all data
- Validate table/column names exist via
orread_schema
firstdescribe_table
Response Format
- Execute tool to get data
- Answer the user's question directly with the result
- Show SQL in ```sql blocks only if the user asks "how" or "show me the query"
- Present numbers clearly: "There are 1,247 orders this month"