Three AI SQL Functions That Just Changed Everything
Thank you for reading my latest article Three AI SQL Functions That Just Changed Everything.
Here at LinkedIn I regularly write about modern data platforms and technology trends. To read my future articles simply join my network here or click 'Follow'. Also feel free to connect with me via YouTube.
--------------------------------------------------------------------------------------------
The Problem Every Data Team Faces (And Finally, The Solution)
Picture this: It's Monday morning, and your customer support team is drowning in 2,000 unread tickets. Your e-commerce team needs to categorize 50,000 product reviews by sentiment. Meanwhile, your marketing team is asking for personalized email content for each of your 100,000 customers.
Traditional approach? Hire a data science team, build custom models, wait 6 months, and hope it works.
What if I told you that you could solve all of these problems with three simple SQL functions that went live last week?
This isn't just another feature release. This is the moment when AI stopped being something that happens "over there" and became something that happens right inside your data warehouse, using the SQL you already know.
Why This Changes Everything
I've spent the last two decades watching organizations struggle with the same fundamental problem: the gap between having data and actually being able to use it intelligently at scale. We've had the data. We've had the compute power. What we've been missing is the intelligence layer that sits between the two.
These three Cortex AI functions—AI_CLASSIFY, AI_FILTER, and AI_COMPLETE—just closed that gap forever.
🎯 AI_CLASSIFY: When Manual Categorization Dies
The old way: Your support team manually tags 2,000 tickets a day. Takes 6 hours. Half are inconsistent. Nobody's happy.
The new way:
SELECT ticket_id,
AI_CLASSIFY(ticket_content,
['billing', 'technical', 'cancellation', 'urgent']
) as category
FROM support_tickets;
Done. All 2,000 tickets categorized in seconds.
But here's what makes this different: You're not locked into predefined categories. Want to classify customer reviews by emotion? Product descriptions by target audience? Social media posts by brand sentiment? Just change the array.
Real example from the trenches: A financial services company used this to automatically route loan applications:
Result? 70% reduction in processing time, 90% improvement in accuracy.
The game-changer: Multi-label classification. One email can be both "urgent" AND "billing" AND "technical." The AI gets it. Your old rule-based system didn't.
🔍 AI_FILTER: When WHERE Clauses Aren't Smart Enough
The problem: You want to find "customers who sound frustrated" in your support chat logs. Good luck writing that WHERE clause.
The solution:
SELECT * FROM chat_transcripts
WHERE AI_FILTER('The customer sounds frustrated or angry');
That's it. No regex patterns. No sentiment score thresholds. No hoping you caught all the edge cases.
But it gets better. This works with images too:
SELECT * FROM product_photos
WHERE AI_FILTER('This image shows a defective product');
Real-world impact: An e-commerce company used this to automatically flag potentially problematic product images before they went live. Caught 95% of issues that previously required manual review.
The intelligence factor: Traditional filtering requires you to anticipate every possible variation. AI filtering understands context, nuance, and intent. It's the difference between following rules and actually thinking.
✨ AI_COMPLETE: When You Need 100,000 Personalized Emails Yesterday
The scenario: Black Friday is coming. You need personalized product recommendations for 100,000 customers based on their purchase history, browsing behavior, and current inventory.
The old approach: Weeks of custom development, complex recommendation engines, hope the data science team has capacity.
The new approach:
SELECT customer_id,
AI_COMPLETE('claude-4-sonnet','Based on this customer profile: ' || customer_data || ' and current promotions: ' || current_offers || ', write a personalized email recommending 3 products with compelling reasons why they would love each one.') as personalized_email
FROM customer_profiles;
The result: 100,000 unique, contextually relevant, personally crafted emails. Generated in minutes, not weeks.
Why this matters: We're not talking about mail merge templates. We're talking about AI that understands customer preferences, seasonal trends, inventory levels, and promotional strategies—then writes like your best marketing copywriter having a personal conversation with each customer.
Real example: A retailer used this approach for their holiday campaign. Open rates increased 340%. Click-through rates jumped 180%. Revenue per email tripled.
The Composable Architecture Moment
Here's what excites me most about these functions: They perfectly demonstrate what I've been talking about regarding composable data architectures.
Modularity in action: Each function does one thing brilliantly and connects seamlessly with everything else.
Intelligence embedded: The AI isn't bolted on—it's woven into the fabric of your data operations.
Scale without complexity: Process 10 rows or 10 million rows with the same simple syntax.
Future-ready: As new models become available, you get access without rebuilding anything.
This is what I mean when I talk about data architectures that adapt and evolve. These functions aren't just solving today's problems—they're creating capabilities you didn't even know you needed.
Getting Started (Because Waiting is Expensive)
Week 1: Get the SNOWFLAKE.CORTEX_USER role and start with AI_CLASSIFY on a small dataset. Pick something concrete like categorizing support tickets or product reviews.
Week 2: Experiment with AI_FILTER to replace your most complex WHERE clauses. Start with the queries that currently require multiple JOINs and conditional logic.
Week 3: Try AI_COMPLETE for content generation. Begin with simple tasks like generating product descriptions or summarizing customer feedback.
Week 4: Scale your winning use cases to production.
The Bottom Line
We've been talking about AI transformation for years. These three functions are what transformation actually looks like: seamless, practical, and immediately useful.
The organizations that master these capabilities first won't just have better data—they'll have intelligent data that works for them instead of against them.
The question isn't whether you'll use these functions. It's whether you'll be among the first to leverage them or among the last to realize what you missed.
Your data has been waiting to get smarter. Now it can.
To stay up to date with the latest business and tech trends in data and analytics, make sure to subscribe to my newsletter, follow me on LinkedIn, and YouTube, and, if you’re interested in taking a deeper dive into Snowflake check out my books ‘Mastering Snowflake Solutions’ and ‘SnowPro Core Certification Study Guide’.
--------------------------------------------------------------------------------------------
About Adam Morton
Adam Morton is an experienced data leader and author in the field of data and analytics with a passion for delivering tangible business value. Over the past two decades Adam has accumulated a wealth of valuable, real-world experiences designing and implementing enterprise-wide data strategies, advanced data and analytics solutions as well as building high-performing data teams across the UK, Europe, and Australia.
Adam’s continued commitment to the data and analytics community has seen him formally recognised as an international leader in his field when he was awarded a Global Talent Visa by the Australian Government in 2020.
Today, Adam is dedicated to helping his clients to overcome challenges with data while extracting the most value from their data and analytics implementations. You can find out more information by visiting his website here.
He has also developed a signature training program that includes an intensive online curriculum, weekly live consulting Q&A calls with Adam, and an exclusive mastermind of supportive data and analytics professionals helping you to become an expert in Snowflake. If you’re interested in finding out more, check out the latest Mastering Snowflake details.
sr operations analyst at Wells Fargo
1moThanks for sharing, Adam