Best Practices for Database Queries

The Database Assistant produces better results when questions are clear, focused, and well scoped. This article outlines best practices that help you get accurate, reliable insights from your database.

Written By Kristė Vagnerytė

Last updated 26 days ago

Start with a Clear Question

Describe what you want to know, not how to query it.

Good examples:

  • “What is our total revenue by month?”

  • “How many orders were placed last quarter?”

Avoid vague requests such as:

  • “Show me everything”

  • “Analyze our data”

Clear questions lead to clearer results.


Be Specific About Timeframes and Metrics

Always specify:

  • The time period (month, year, date range)

  • The metric (revenue, orders, users)

Example:

What is the average order value by month for the past year?

This reduces ambiguity and improves accuracy.


Ask One Question at a Time

Focus on one goal per request.

Instead of combining:

  • analysis

  • visualization

  • reporting

into one step, start with analysis and build from there.


Request Visuals and Documents Explicitly

Charts and documents are not created automatically.

If you want them, ask explicitly.

Example:

What are our sales by month? Create a line chart.

or

Summarize our revenue trends in a short report.


Review and Refine Results

If the result is close but not exact:

  • Ask for clarification

  • Narrow the scope

  • Request a different grouping or timeframe

Small refinements often produce much better results.


Use Simple Language

You do not need technical or SQL-specific language.

Natural, business-focused questions work best.

Example:

Which products generate the highest revenue?

The assistant handles query generation automatically.


Avoid Common Pitfalls

  • Asking overly broad questions

  • Mixing multiple goals in one request

  • Forgetting to specify timeframes

  • Expecting automatic charts or reports

Avoiding these issues improves consistency and reliability.


What to Read Next