sql-querieslisted
Install: claude install-skill aiskillstore/marketplace
# 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:
```sql
SELECT * FROM "schema"."table" LIMIT 100;
```
### CTEs for complex queries
```sql
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
```sql
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
```sql
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 |
|------|-------------|
| `read_schema` | First call — understand table structure |
| `get_table_data` | Preview rows before writing complex queries |
| `execute_query` | Run SELECT queries (SELECT/WITH only) |
| `describe_table` | Get column details, FK relationships |
| `