Prompt Details
Model
(gemini-3.1-pro)
Token size
223
Example input
[Database Schema]: Users table with id and name, Orders table with id, user_id, order_date, and amount
[Business Objective]: Calculate total revenue per user for the last 30 days
Example output
1. Schema Analysis
Requires a JOIN between Users and Orders on the user_id column. We need to filter orders by the order_date column and aggregate the amount.
2. Optimized SQL Query
SELECT u.name, SUM(o.amount) as total_revenue FROM Users u JOIN Orders o ON u.id = o.user_id WHERE o.order_date >= CURRENT_DATE - INTERVAL '30 days' GROUP BY u.name;
3. Performance Rationale
Using the INTERVAL operator allows the database engine to perform an index scan on the order_date column, which is significantly faster than a full table scan.
By purchasing this prompt, you agree to our terms of service
GEMINI-3.1-PRO
Stop writing slow, inefficient queries. This SQL Architect designs optimized schema structures, writes high-performance SQL queries, and identifies potential bottlenecks in your database execution plan. It bridges the gap between raw data and actionable insight. Don't just pull data; engineer your queries for scale. Stop debugging slow reports; start deploying performant, production-ready code.
What it provides:
• Schema Efficiency Audit
• Optimized SQL Syntax
• Performance Rationale
Essential
...more
Added over 1 month ago
