Mi Analytics and Research Consult

Office Address

227 New Home Nike Enugu

Phone Number

+234 703 392 6636

Email Address

contact@mianalytics.org

Natural-Language Analytics & AISQL

Natural-Language Analytics & AISQL

In the past year, one of the most interesting developments in enterprise data has been the arrival of AI-powered SQL. For decades, SQL has been the language of structured data, fast, reliable, and universally understood across databases. But as organizations store more unstructured and multimodal data (text, images, audio), SQL alone often struggles to unlock insight.

Generative AI is starting to change that. Instead of writing complex queries, teams can express intent in natural language. Instead of handling only numeric or text columns, new systems can analyze product reviews, medical notes, regulatory filings, and even images, directly inside the database.

This is where AISQL comes in, a broad term for efforts to integrate artificial intelligence with SQL engines. Snowflake’s Cortex AISQL is the most visible commercial example, but platforms like AI2sql and research projects such as GaussDB-AISQL show a wider movement. The promise is straightforward: let analysts and engineers query data more naturally, reduce overhead in preparing AI workflows, and improve performance while doing so.

The details, however, are much more interesting.

The Current State of SQL and AI

SQL has always been a lingua franca for data. It works across MySQL, PostgreSQL, Snowflake, BigQuery, and countless other systems. But SQL has a limitation baked into its DNA: it was designed for structured tables. That makes it excellent for transactions and reporting, but far less capable when the task is, say, “summarize customer sentiment from 10,000 reviews” or “classify patient notes into diagnostic categories.”

Traditionally, the workaround involved exporting data into pipelines: extract from the database, feed into machine learning models, then write results back. That’s a slow loop, requires specialized engineering skills, and makes real-time analysis difficult.

Generative AI provides a shortcut. By embedding AI functions into SQL itself, analysts can apply natural-language filters, join unstructured with structured data, or run summarizations, all within the database. The SQL engine becomes not just a query processor but an AI runtime.

This convergence explains why vendors, startups, and researchers are all experimenting with AISQL.

Trends of AISQL

1. Commercial Platforms: Snowflake Cortex AISQL

Snowflake is pushing AISQL into production environments with Cortex. Available in public preview, it introduces functions like:

  • AI_FILTER: Use natural language in WHERE clauses, e.g., filter customer reviews for “complaints about delivery speed.”

  • AI_JOIN: Match rows across tables using semantic similarity, not just key equality.

  • AI_AGG: Aggregate values with AI assistance, such as grouping feedback into themes.

  • AI_CLASSIFY: Categorize text or images into multiple labels at once.

These are more than conveniences. Benchmarks show 30–70% faster execution compared to manual pipelines, with up to 60% lower costs for complex queries. Snowflake achieves this by routing lightweight queries to smaller language models while reserving larger models for heavy tasks.

Use cases span industries: finance teams filtering regulatory reports, retailers tracking sentiment shifts in reviews, healthcare providers analyzing patient notes. What makes it compelling is that all of this happens in SQL, the skill set companies already have.

2. Natural-Language-to-SQL Services: AI2sql

While Snowflake embeds AI inside the SQL engine, tools like AI2sql focus on helping people write queries. You describe your goal in plain language, “Top 5 products by revenue in the past 30 days”, and the system generates a query in your chosen dialect, whether that’s PostgreSQL or BigQuery.

This is particularly helpful for less technical users or for speeding up everyday analytics. AI2sql also offers query validation, formatting, and explanations, which makes the generated SQL more trustworthy. Still, it’s best used with schema context and human review, since ambiguity in prompts can lead to incorrect results.

3. Research Systems: GaussDB-AISQL

On the research side, GaussDB-AISQL reimagines what a cloud-native SQL system can do. Instead of bolting AI functions onto SQL, it treats AI models as first-class citizens. The database manages storage, compute, and AI engines separately, allowing model training and inference directly via SQL commands.

This design leads to impressive performance: reports show up to 19× faster execution for AI tasks compared to traditional setups. While still experimental, it signals a future where databases not only store data but also host and serve AI models without external orchestration.

Actionable Insights for Enterprises

For organizations evaluating AISQL, there are practical lessons from both vendors and early adopters:

  1. Start with Use Cases That Cross Structured and Unstructured Data.
    Sentiment analysis of reviews, classification of documents, or semantic joins between customer records and notes are strong candidates.

  2. Always Provide Schema Context.
    Whether using AI2sql or fine-tuned LLMs, accuracy improves significantly when the model has column names, data types, and relationships.

  3. Balance Accuracy and Responsiveness.
    Enterprises that fine-tune LLMs on domain-specific data report up to 95% accuracy with sub-7-second response times, compared to 85% accuracy and much slower results with generic prompting.

  4. Treat AI Outputs as Drafts, Not Final Answers.
    Even with high accuracy, SQL generated by AI should be validated before going into production pipelines.

  5. Monitor Costs as Closely as Performance.
    AISQL promises efficiency, but performance gains often come from routing queries through different model tiers. Knowing which workloads justify larger models is essential to keeping costs under control.

Practical Examples with Cortex AISQL

One of the strongest arguments for AISQL is its simplicity in action. Below are examples of how Snowflake’s new AI primitives extend SQL without breaking familiar syntax.

1. Filtering with Natural Language

SELECT review_id, review_text
FROM product_reviews
WHERE AI_FILTER(review_text, 'complaints about delivery speed');

This query returns only the reviews where the AI model detects delivery speed issues — even if customers use different wording like “slow shipping” or “late package.”

2. Semantic Joins Across Tables

SELECT c.customer_id, c.notes, t.ticket_summary
FROM customers c
AI_JOIN support_tickets t
ON AI_SIMILARITY(c.notes, t.ticket_summary) > 0.8;

Here, customer notes are matched with support tickets if their meaning is close, regardless of exact phrasing.

3. AI-Assisted Aggregation

SELECT product_id,
AI_AGG(review_text, 'summarize customer sentiment by theme') AS sentiment_summary
FROM product_reviews
GROUP BY product_id;

The result: concise summaries like “fast shipping, but fragile packaging,” which would otherwise take hours of manual tagging.

4. Classification of Multimodal Data

SELECT product_id,
AI_CLASSIFY(product_image, 'categories: electronics, clothing, furniture, toys') AS category
FROM product_catalog;

Each image is automatically labeled into the most relevant category, removing the need for manual sorting.

5. Sentiment Analysis at Scale

SELECT product_id,
AI_AGG(AI_SENTIMENT(review_text), 'average sentiment') AS avg_sentiment
FROM product_reviews
GROUP BY product_id;

This produces an aggregate sentiment score per product, which can then drive dashboards or alerts.

These examples highlight the practical benefit of AISQL: analysts no longer need to leave SQL to access AI capabilities. Queries remain concise, but the scope of what SQL can handle expands dramatically.

Conclusion

The real shift with AISQL is not whether AI can “write SQL for us.” That’s the superficial framing. The deeper change is that SQL itself is being expanded into a language that can handle natural language, semantics, and multimodal data directly.

As Michael Stonebraker, one of SQL’s original pioneers, once said: “Databases are not about data. They are about turning data into useful information.” AISQL pushes this vision into a new era. Instead of exporting data to separate AI systems, we bring AI into the database. Instead of forcing humans to learn complex model pipelines, we let them speak in SQL and natural language.

The challenge now is practical adoption, choosing the right workloads, validating results, and aligning AI costs with business outcomes. But the direction is clear: SQL and AI are not parallel tracks. They are converging. And the databases of the future will look much more like AISQL than the query engines of the past.

Leave a Reply

Your email address will not be published. Required fields are marked *

Book a Session

Ever find yourself struggling with a research paper, data analysis, or making use of an analytic tool?

    We tackle research problems at any scale, uncover insights through lasting analytical solutions, and embrace advanced data methodologies.

    Information

    Past Seminars

    Copyright © 2025 Mi Analytics. All Rights Reserved.