Back to Catalog

Talk to MySQL using Natural Language Query (NLQ) with AI

IntermediateGuided Project

Learn how to use AI-powered Natural Language Queries (NLQ) to interact with MySQL databases using plain English. You'll discover how to count, join, describe tables, and perform grouping operations - all without writing SQL code. This lab demonstrates how AI can transform data analysis by making it more intuitive and accessible. By enabling users to simply ask questions in everyday language, teams can quickly gain valuable insights from their data without needing SQL expertise.

4.8 (16 Reviews)

Language

  • English

Topic

  • Artificial Intelligence

Skills You Will Learn

  • Natural Language Processing, SQL, Artificial Intelligence, MySQL, Python, LangChain

Offered By

  • IBMSkillsNetwork

Estimated Effort

  • 30 minutes

Platform

  • SkillsNetwork

Last Update

  • May 11, 2025
About this Guided Project
In this guided project, you will learn how to leverage AI-powered Natural Language Queries (NLQ) to interact with databases, like MySQL and MariaDB, using plain English. Through hands-on examples, you'll discover how to count records, describe table structures, join multiple tables, and perform grouping operations - all without writing SQL code. This lab demonstrates how AI can transform data analysis by making it more intuitive and accessible. By enabling users to simply ask questions in everyday language, teams can quickly gain valuable insights from their data without needing SQL expertise. In just 30 minutes, you'll set up a system that empowers business users and stakeholders to directly query databases, democratizing access to data-driven decision making.


Natural language query (NLQ)            
"How many employees are there"
AI-generated Structured Query Language (SQL)
SELECT COUNT(*) FROM Employee 
-------------------------------------------------------------------------------------------------------------------------
Natural language query (NLQ)            
"How many Albums are there in the database?"
AI-generated Structured Query Language (SQL)
SELECT COUNT(*) FROM Album          
-------------------------------------------------------------------------------------------------------------------------
Natural language query (NLQ)            
"Can you left join table Artist and table Album by ArtistId? Please show me 5 Name and AlbumId in the joint table."
AI-generated Structured Query Language (SQL)
SELECT Artist.Name, Album.AlbumId FROM Artist  LEFT JOIN Album ON Artist.ArtistId = Album.ArtistId LIMIT 5;
--------------------------------------------------------------------------------------------------------------------------------------
Natural language query (NLQ)            
" Which country's customers spent the most by invoice?"
AI-generated Structured Query Language (SQL)
SELECT Customer.Country, SUM(Invoice.Total) FROM Customer
INNER JOIN Invoice ON Customer.CustomerId = Invoice.CustomerId     
GROUP BY Customer.Country   
ORDER BY SUM(Invoice.Total) DESC LIMIT 1;   
--------------------------------------------------------------------------------------------------------------------------------------


**Natural Language Query (NLQ):** Describe the PlaylistTrack table
**Response:**

**Natural Language Query (NLQ):** How many employees are there
**Response:**


**Natural Language Query (NLQ):** Can you left join table Artist and table Album by ArtistId? Please show me 5 Name and AlbumId in the joint table.
**Response:**
  




What You'll Learn
After completing this project, you will be able to:

- **Integrate natural language processing**: Use AI tools to interpret natural language queries.
- **Execute SQL queries from natural language**: Translate natural language questions into SQL queries to fetch relevant data from the MySQL database.

What You'll Need
Before starting this guided project, you should have:
- An understanding of natural language processing concepts is beneficial but not required.
- Access to a modern web browser such as Chrome, Edge, Firefox, Internet Explorer, or Safari.

Instructors

Ricky Shi

Data Scientist at IBM

Ricky Shi is a Data Scientist at IBM, specializing in deep learning, computer vision, and Large Language Models. He applies advanced machine learning and generative AI techniques to solve complex challenges across various sectors. As an enthusiastic mentor, Ricky is committed to helping colleagues and peers master technical intricacies and drive innovation.

Read more

Contributors

Karan Goswami

Data Scientist

I am a dedicated Data Scientist and an AI enthusiast, currently working at IBM's Skills Builder Network. Learning how some simple mathematical operations could be used to make predictions and discover patterns sparked my curiosity, leading me to explore the exciting world of AI. Over the years, I’ve gained hands-on experience in building scalable AI solutions, fine-tuning models, and extracting meaningful insights from complex datasets. I'm driven by a desire to apply these skills to solve real-world problems and make a meaningful impact through AI.

Read more

Joseph Santarcangelo

Senior Data Scientist at IBM

Joseph has a Ph.D. in Electrical Engineering, his research focused on using machine learning, signal processing, and computer vision to determine how videos impact human cognition. Joseph has been working for IBM since he completed his PhD.

Read more

Kunal Makwana

Data Scientist

I’m a passionate Data Scientist and AI enthusiast, currently working at IBM on innovative projects in Generative AI and machine learning. My journey began with a deep interest in mathematics and coding, which inspired me to explore how data can solve real-world problems. Over the years, I’ve gained hands-on experience in building scalable AI solutions, fine-tuning models, and leveraging cloud technologies to extract meaningful insights from complex datasets.

Read more

Wojciech "Victor" Fulmyk

Data Scientist at IBM

As a data scientist at the Ecosystems Skills Network at IBM and a Ph.D. candidate in Economics at the University of Calgary, I bring a wealth of experience in unraveling complex problems through the lens of data. What sets me apart is my ability to seamlessly merge technical expertise with effective communication, translating intricate data findings into actionable insights for stakeholders at all levels. Follow my projects to learn data science principles, machine learning algorithms, and artificial intelligence agent implementations.

Read more