Data Science

Can I use SQL to perform Predictive Analysis directly within the database using AI integrations?

LI Asked by Linda Thompson · 15-06-2025
▲ 0 upvotes 18,237 views 0 comments
The question

I’ve heard about "BigQuery ML" and "Snowflake Cortex." Can I actually write a SQL query to predict customer churn without exporting my data to Python or R? How accurate are these SQL-based models compared to traditional Scikit-learn approaches?

3 answers

▲ 0
SU
Answered on 20-06-2025

Yes, in-database ML is the biggest trend for 2025. With BigQuery ML, you can literally write CREATE MODEL ... OPTIONS(model_type='logistic_reg') AS SELECT .... The accuracy is surprisingly comparable to Scikit-learn because, under the hood, these platforms are using the same algorithms. The massive advantage is data gravity—you don't have to move 5TB of data to a notebook. In my last project, we deployed a churn model entirely in SQL, which allowed our analysts to refresh predictions every hour without any Python scripts.

▲ 0
GE
Answered on 23-06-2025

Are you worried about the lack of fine-tuning options in SQL, or is the ease of deployment more important for your current business use case?

WI 26-06-2025

Deployment is definitely the priority. We don't have a dedicated MLOps team, so if our Data Analysts can deploy models using just SQL, it saves us months of work. However, I am curious about feature engineering. Can I do things like One-Hot Encoding or scaling directly in the TRANSFORM clause of the SQL model creation, or should that be handled in a separate view first?

▲ 0
MA
Answered on 28-06-2025

It's great for 80% of use cases. If you need a simple regression or classification, SQL is faster. If you need a custom deep learning architecture, stick to Python.

LI 30-06-2025

Well said, Martha. It’s all about the right tool for the job. For most business reporting, "good enough" SQL ML is a game changer.

Share your thoughts

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

Still have questions? Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Book Free Session

Book Free Session