Natural Language Queries
Learn how to effectively query your data using natural language
GoPie's natural language interface transforms the way you interact with data. Instead of writing SQL, simply ask questions in plain English, and GoPie's AI will understand your intent and generate the appropriate queries.
How It Works
GoPie uses advanced language models to:
- Understand Intent - Parse your question to identify what you want to know
- Map to Schema - Match your terms to actual tables and columns
- Generate SQL - Create optimized queries for your database
- Execute & Format - Run queries and present results clearly
- Suggest Visualizations - Recommend appropriate charts for your data
GoPie's AI has been trained on millions of data questions and continuously improves based on usage patterns.
Getting Started with Natural Language
Basic Questions
Start with simple questions about your data:
Example Questions:
"Show me total sales by month"
"What are our top 10 products?"
"Which regions have the highest revenue?"
"Compare this year's sales to last year"
"Find customers who haven't ordered in 90 days"
Generated SQL Example:
-- "Show me total sales by month"
SELECT
DATE_TRUNC('month', order_date) as month,
SUM(total_amount) as total_sales
FROM sales
GROUP BY month
ORDER BY month DESC;
Example Questions:
"How many new users signed up this week?"
"What's the average session duration?"
"Show user growth over the last 6 months"
"Which features are most popular?"
"Find power users (top 10% by activity)"
Generated SQL Example:
-- "How many new users signed up this week?"
SELECT COUNT(*) as new_users
FROM users
WHERE created_at >= CURRENT_DATE - INTERVAL '7 days';
Example Questions:
"What's our current burn rate?"
"Show revenue by customer segment"
"Calculate gross margin by product"
"What are our biggest expenses?"
"Project revenue for next quarter"
Generated SQL Example:
-- "Calculate gross margin by product"
SELECT
product_name,
SUM(revenue) as total_revenue,
SUM(cost) as total_cost,
(SUM(revenue) - SUM(cost)) / SUM(revenue) * 100 as gross_margin_pct
FROM financial_data
GROUP BY product_name
ORDER BY gross_margin_pct DESC;
Best Practices for Natural Language Queries
1. Be Specific
Too Vague | Specific |
---|---|
"Show sales" | "Show total sales by product category for last quarter" |
"User data" | "List active users who logged in this month" |
"Revenue" | "Compare monthly revenue year-over-year" |
2. Include Time Frames
Always specify when you want data from:
- "last 30 days"
- "this quarter"
- "between January and March 2024"
- "year to date"
- "compared to same period last year"
3. Specify Aggregations
Be clear about how you want data grouped:
- "by month"
- "per customer"
- "grouped by region"
- "daily average"
- "running total"
4. Use Business Terms
GoPie learns your terminology:
- If you call revenue "bookings", use that term consistently
- Define customer segments by your business rules
- Use your product names and categories
Advanced Query Patterns
Comparisons and Trends
"Compare this month's revenue to last month"
"Show the trend of user signups over the last year"
"What's the growth rate of active users?"
"How do sales this quarter compare to our target?"
Filtering and Conditions
"Show only premium customers in California"
"Find orders over $1000 placed on weekends"
"List products with inventory below reorder point"
"Customers who bought X but not Y"
Complex Calculations
"Calculate customer lifetime value by cohort"
"What's the conversion rate from trial to paid?"
"Show moving 7-day average of daily revenue"
"Calculate year-over-year growth by product line"
Statistical Analysis
"What's the standard deviation of order values?"
"Show the distribution of customer ages"
"Find outliers in transaction amounts"
"Calculate correlation between price and sales volume"
Context-Aware Conversations
GoPie maintains context throughout your conversation:
You can build on previous questions without repeating context:
- "Show me sales by region"
- "Now break that down by product" (GoPie knows you mean sales by region AND product)
- "Just show me the top 5" (GoPie filters the previous result)
Follow-up Questions
After getting initial results, you can:
- "Filter that to only show values over $10,000"
- "Add a column for percentage of total"
- "Now show me the same thing for last year"
- "Export this to CSV"
- "Create a chart from this data"
Clarifying Ambiguity
When GoPie isn't sure, it will ask for clarification:
You: "Show me user activity"
GoPie: "I found several activity-related columns. Which would you like to see?
- Last login date
- Total sessions
- Actions performed
- Time spent"
Query Suggestions and Auto-Complete
As you type, GoPie provides:
Smart Suggestions
- Common questions for your dataset
- Frequently used filters
- Popular time ranges
- Relevant metrics
Column Recognition
GoPie automatically recognizes:
- Date/time columns for time-based analysis
- Numeric columns for calculations
- Category columns for grouping
- ID columns for joining
Template Questions
Use question templates for consistency:
"Show me [metric] by [dimension] for [time period]"
"Compare [metric] between [segment A] and [segment B]"
"What's the [calculation] of [metric] grouped by [dimension]"
Handling Special Cases
Null Values
Be explicit about how to handle missing data:
- "Include records with missing values"
- "Exclude null prices"
- "Treat missing as zero"
- "Show only complete records"
Date Handling
Specify date formats and timezones:
- "Convert all times to PST"
- "Use fiscal year starting in July"
- "Show dates in MM/DD/YYYY format"
- "Group by week starting Monday"
Currency and Units
Clarify units when needed:
- "Show revenue in thousands"
- "Convert prices to EUR"
- "Display weights in metric"
- "Round to nearest hundred"
Performance Tips
1. Start Broad, Then Narrow
Good approach:
1. "Show me all sales data" (see structure)
2. "Now just show last month" (filter)
3. "Group by product category" (aggregate)
2. Use Sampling for Large Datasets
"Show me a sample of 1000 transactions"
"Use 10% sample for initial analysis"
"Preview first 100 rows"
3. Leverage Indexes
Ask about commonly filtered columns:
- Dates (usually indexed)
- IDs (primary keys)
- Status fields
- Category columns
Common Pitfalls and Solutions
Ambiguous Column Names
Problem: "Show revenue" when you have revenue
, net_revenue
, gross_revenue
Solution: Be specific: "Show gross revenue before discounts"
Time Zone Confusion
Problem: "Sales yesterday" might mean different things
Solution: Specify timezone: "Sales yesterday in PST"
Aggregation Errors
Problem: "Average order value" without specifying grouping
Solution: Clear grouping: "Average order value by month"
Integration with Other Features
From Natural Language to SQL
After GoPie generates a query, you can:
- View the generated SQL
- Edit it in SQL Playground
- Save it for reuse
- Share with team members
Creating Visualizations
Natural language works for charts too:
- "Create a line chart of monthly revenue"
- "Show this as a pie chart"
- "Make a bar chart comparing regions"
- "Plot sales over time with a trend line"
Exporting Results
Request exports directly:
- "Export this to Excel"
- "Send me a CSV of these results"
- "Create a PDF report"
- "Generate an API endpoint for this query"
Tips for Success
- Start Simple - Begin with basic questions and add complexity
- Use Examples - Provide sample values: "like 'Electronics' or 'Clothing'"
- Iterate - Refine your questions based on results
- Save Favorites - Save commonly used queries for quick access
- Learn from SQL - Review generated SQL to understand the logic
What's Next?
- SQL Playground - Write and edit SQL directly
- Creating Charts - Visualize your query results
- Query History - Manage and reuse queries