Can AI (NLP) convert user questions (text) into database SQL queries?

I have been reading about NLP but got confused and not able to figure out - if it is feasible for NLP to convert questions in natural language to transform into SQL queries (so that it can execute on concerned database and fetch the output).

Ex. If the user raises a question to the AI engine (application) -

How many new customers have registered on my website this month?

The AI should parse this using NLP techniques and convert it into SQL and execute on database table say "User_management" -

select count(1) from User_management
where joining_month = 'Oct' and joining_year = 2019

Please share your thoughts and advice.

Update 1) Got this SO link and this NLTK chapter as starting point

Topic ai chatbot neural-network nlp

Category Data Science


Yes it is possible. You can train end to end an RNN over the training data. It means input the user query as an input and set the output for the sql query. Definitely the most challenging part is preparing the training set as RNN needs a lot of data to be learned.

Also, for the training set, it might you can use a GAN‌ to generate more queries for the users' query dataset that you have. Notice that, as you want the query generator for the specific schema of the database, you need your own training data and it could not be generalized over all kinda schemas.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.