IP Library Granted Patent US 12,511,282
Granted Patent B1
US 12,511,282 · App. 18/653,504 · Granted Dec 30, 2025

Generating structured query language using machine learning

Inventors: Ananya Ojha (Dunn Loring, VA); William Hurwood (Washington, DC)
Assignee: MicroStrategy Incorporated
G06F16/24522G06F16/2423G06F16/248
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,511,282
App. No.
18/653,504
Granted
Dec 30, 2025
Kind
B1
Abstract

Methods, systems, and apparatus, including computer programs encoded on computer-storage media, for generating structured query language using machine learning. In some implementations, a system provides an interface configured to receive input comprising data processing criteria expressed in natural language text. The system receives natural language input through the interface, where the natural language input specifies one or more criteria for retrieving or generating data from a data set. The system obtains a structured query language (SQL) statement generated by an artificial intelligence or machine learning (AI/ML) model based on the natural language input, and the system provides the SQL statement through the interface.

Claims (61)

1 . A method performed by one or more computers, the method comprising:

providing, by the one or more computers, an interface configured to receive input comprising data processing criteria expressed in natural language text;

receiving, by the one or more computers, natural language input through the interface, wherein the natural language input specifies one or more criteria for retrieving or generating data from a data set;

determining that the data set is relevant to the natural language input; and

based on determining that the data set is relevant to the natural language input, selecting a data model for the data set;

obtaining, by the one or more computers, a structured query language (SQL) statement generated by an artificial intelligence or machine learning (AI/ML) model based on the natural language input, wherein obtaining the SQL statement comprises causing the AI/ML model to process the natural language input using the selected data model as context, and wherein the SQL statement expresses the one or more criteria from the natural language input using references to components of the data set or logical objects of the data set; and

providing, by the one or more computers, the SQL statement through the interface.

2 . The method of claim 1 , wherein the AI/ML model is a large language model.

3 . The method of claim 2 , wherein the large language model has been trained based on examples of computer-generated SQL statements and corresponding user-edited SQL statements made by editing the computer-generated SQL statements.

4 . The method of claim 1 , wherein obtaining the SQL statement comprises:

sending a request for the AI/ML model to generate the SQL statement, wherein the request includes:

the natural language input or a natural language instruction the AI/ML model that is generated based on the natural language input; and

data indicating contents or structure of the data set; and

receiving the SQL statement that the AI/ML model generated, in which elements of the natural language input are mapped to or translated to components of the data set.

5 . The method of claim 4 , wherein the data indicating the contents or structure of the data set comprises an object model or database schema for the data set.

6 . The method of claim 1 , wherein obtaining the SQL statement comprises generating an instruction to a large language model based on the natural language text.

7 . The method of claim 1 , wherein determining that the data set is relevant to the natural language input comprises:

comparing terms of the natural language input to data models for data sets or metadata for data sets; and

determining that the data set is relevant to the natural language input based on a match or similarity of the terms of the natural language input and the data model for the data sets or the metadata for the data set.

8 . The method of claim 1 , wherein determining that the data set is relevant to the natural language input comprises:

receiving data indicating an identifier for a data set used to provide content that is displayed in or selected on user interface content presented with a user interface in which the natural language input is entered; and

determining that the data set is relevant to the natural language input based on the received identifier.

9 . The method of claim 1 , comprising receiving the natural language input through an application programming interface (API).

10 . The method of claim 1 , comprising:

receiving the natural language input over a network from a user device; and

providing the SQL statement to the user device over a network for display in a user interface of a client device.

11 . The method of claim 1 , comprising:

providing the SQL statement to a database system;

obtaining results that the database system generates based on executing the SQL statement; and

providing at least a portion of the results or natural language text describing the results in response to the natural language input.

12 . The method of claim 1 , wherein the criteria specified by the natural language input comprise one or more of a data set from which to retrieve data, a type of data to retrieve, a selection criterion, a filter criterion, or a sorting criterion.

13 . The method of claim 1 , comprising:

saving the SQL statement at a server system;

creating an object representing the SQL statement or a set of results obtained from executing the SQL statement to obtain data from the data set;

causing a representation of the object to be provided in a user interface, wherein the representation of the object is interactive and configured to provide, upon interaction by a user, access to the SQL statement or a set of results generated by executing the SQL statement.

14 . The method of claim 13 , comprising forming an association between the object with the data set or a user, a document, or a project that is active when the natural language input is provided;

wherein the representation of the object is selectively caused to be presented based on the context of an application, wherein causing the representation of the object to be provided in the user interface is performed in response to determining that the user interface is associated with the data set or the user, the document, or the project.

15 . The method of claim 1 , wherein the data model indicates logical objects of the data set, including metrics or attributes that are stored in or can be derived from columns of data in the data set.

16 . A system comprising:

one or more computers; and

one or more non-transitory computer-readable media storing instructions that are operable, when executed by the one or more computers, to cause the system to perform operations comprising:

providing, by the one or more computers, an interface configured to receive input comprising data processing criteria expressed in natural language text;

receiving, by the one or more computers, natural language input through the interface, wherein the natural language input specifies one or more criteria for retrieving or generating data from a dataset;

determining that the data set is relevant to the natural language input; and

based on determining that the data set is relevant to the natural language input, selecting a data model for the data set;

obtaining, by the one or more computers, a structured query language (SQL) statement generated by an artificial intelligence or machine learning (AI/ML) model based on the natural language input, wherein obtaining the SQL statement comprises causing the AI/ML model to process the natural language input using the selected data model as context, and wherein the SQL statement expresses the one or more criteria from the natural language input using references to components of the data set or logical objects of the data set; and

providing, by the one or more computers, the SQL statement through the interface.

17 . The system of claim 16 , wherein the AI/ML model is a large language model.

18 . The system of claim 17 , wherein the large language model has been trained based on examples of computer-generated SQL statements and corresponding user-edited SQL statements made by editing the computer-generated SQL statements.

19 . The system of claim 16 , wherein obtaining the SQL statement comprises:

sending a request for the AI/ML model to generate the SQL statement, wherein the request includes:

the natural language input or a natural language instruction the AI/ML model that is generated based on the natural language input; and

data indicating contents or structure of the data set; and

receiving the SQL statement that the AI/ML model generated, in which elements of the natural language input are mapped to or translated to components of the data set.

20 . One or more non-transitory computer-readable media storing instructions that are operable, when executed by one or more computers, to cause the one or more computers to perform operations comprising:

providing, by the one or more computers, an interface configured to receive input comprising data processing criteria expressed in natural language text;

receiving, by the one or more computers, natural language input through the interface, wherein the natural language input specifies one or more criteria for retrieving or generating data from a data set;

determining that the data set is relevant to the natural language input; and

based on determining that the data set is relevant to the natural language input, selecting a data model for the data set;

obtaining, by the one or more computers, a structured query language (SQL) statement generated by an artificial intelligence or machine learning (AI/ML) model based on the natural language input, wherein obtaining the SQL statement comprises causing the AI/ML model to process the natural language input using the selected data model as context, and wherein the SQL statement expresses the one or more criteria from the natural language input using references to components of the data set or logical objects of the data set; and

providing, by the one or more computers, the SQL statement through the interface.

Assignments (2)
CHANGE OF NAME Recorded Sep 19, 2025
From: MICROSTRATEGY INCORPORATED
To: STRATEGY INC
Reel/Frame 072909/0658 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 13, 2024
From: OJHA, ANANYA; HURWOOD, WILLIAM
To: MICROSTRATEGY INCORPORATED
Reel/Frame 067713/0263 →
Continuity (2)
Provisional Application 63463421 · May 2, 2023
Provisional Application 63463511 · May 2, 2023
References Cited (143)
US 8892534B2 · Hamlescher et al. · 2014 [cited by applicant]
US 9369410B2 · Capper et al. · 2016 [cited by applicant]
US 10025819B2 · Chang et al. · 2018 [cited by applicant]
US 10430407B2 · Bhatt et al. · 2019 [cited by applicant]
US 10482394B2 · Syed et al. · 2019 [cited by applicant]
US 10747761B2 · Zhong et al. · 2020 [cited by applicant]
US 10824658B2 · Bakis et al. · 2020 [cited by applicant]
US 10872083B2 · Lin et al. · 2020 [cited by applicant]
US 11023461B2 · Rumiantsau et al. · 2021 [cited by applicant]
US 11086861B2 · Staar et al. · 2021 [cited by applicant]
US 11120344B2 · Das et al. · 2021 [cited by applicant]
US 11295194B2 · Romero · 2022 [cited by applicant]
US 11341439B2 · Meharwade et al. · 2022 [cited by applicant]
US 11449500B2 · Wang et al. · 2022 [cited by applicant]
US 11449796B2 · Song et al. · 2022 [cited by applicant]
US 11455306B2 · Maheshwari et al. · 2022 [cited by applicant]
US 11468054B2 · Chaudhuri et al. · 2022 [cited by applicant]
US 11526507B2 · Zhong et al. · 2022 [cited by applicant]
US 11550783B2 · Lee et al. · 2023 [cited by applicant]
US 11562044B1 · Du · 2023 [cited by examiner]
US 11567965B2 · Liao et al. · 2023 [cited by applicant]
US 11625620B2 · Singaraju et al. · 2023 [cited by applicant]
US 11682390B2 · Temkin et al. · 2023 [cited by applicant]
US 11748577B1 · Aberle · 2023 [cited by applicant]
US 11763129B2 · Cao et al. · 2023 [cited by applicant]
US 11768831B2 · Scholak et al. · 2023 [cited by applicant]
US 11775868B1 · Song et al. · 2023 [cited by applicant]
US 11789945B2 · Lee · 2023 [cited by applicant]
US 11803541B2 · Zheng et al. · 2023 [cited by applicant]
US 11907226B2 · Vo et al. · 2024 [cited by applicant]
US 11941034B2 · Balakavi et al. · 2024 [cited by applicant]
US 11960514B1 · Taylert et al. · 2024 [cited by applicant]
US 11960575B1 · Sainani et al. · 2024 [cited by applicant]
US 11989507B2 · Tunstall-Pedoe et al. · 2024 [cited by applicant]
US 11995073B2 · Lee · 2024 [cited by applicant]
US 12039285B2 · Ramanna et al. · 2024 [cited by applicant]
US 12061970B1 · Lo · 2024 [cited by applicant]
US 12105729B1 · Haq et al. · 2024 [cited by applicant]
US 12124440B1 · Romero Calvo · 2024 [cited by examiner]
US 12135768B2 · Ailawadi · 2024 [cited by examiner]
US 12182147B1 · Merchant · 2024 [cited by examiner]
US 12243646B1 · Paul, Jr. et al. · 2025 [cited by applicant]
US 12265570B2 · Siebel et al. · 2025 [cited by applicant]
US 12271360B1 · Nguyen et al. · 2025 [cited by applicant]
US 12277409B1 · Leeman-Munk et al. · 2025 [cited by applicant]
US 12307203B2 · Goslin · 2025 [cited by examiner]
US 12332876B2 · Cunningham · 2025 [cited by examiner]
US 20070027905A1 · Warren et al. · 2007 [cited by applicant]
US 20170262501A1 · Namboodiri et al. · 2017 [cited by applicant]
US 20200134511A1 · Ho et al. · 2020 [cited by applicant]
US 20200251111A1 · Temkin et al. · 2020 [cited by applicant]
US 20200301925A1 · Zhong et al. · 2020 [cited by applicant]
US 20200313924A1 · Park et al. · 2020 [cited by applicant]
US 20200327196A1 · Sampat et al. · 2020 [cited by applicant]
US 20200334233A1 · Lee et al. · 2020 [cited by applicant]
US 20200387550A1 · Cappetta et al. · 2020 [cited by applicant]
US 20210133234A1 · Bedadala et al. · 2021 [cited by applicant]
US 20210173829A1 · Zeng et al. · 2021 [cited by applicant]
US 20220058114A1 · Ranjan Jena · 2022 [cited by examiner]
US 20220147515A1 · Nair · 2022 [cited by examiner]
US 20220358125A1 · Scholak et al. · 2022 [cited by applicant]
US 20230169075A1 · Han et al. · 2023 [cited by applicant]
US 20230306061A1 · Bui et al. · 2023 [cited by applicant]
US 20230359617A1 · Misra · 2023 [cited by applicant]
US 20240012810A1 · Lee · 2024 [cited by applicant]
US 20240095491A1 · Birru et al. · 2024 [cited by applicant]
US 20240202221A1 · Siebel et al. · 2024 [cited by applicant]
US 20240281222A1 · Trummer · 2024 [cited by applicant]
US 20240283757A1 · Lai · 2024 [cited by applicant]
US 20240303263A1 · Ojha · 2024 [cited by examiner]
US 20240330421A1 · Ailawadi · 2024 [cited by examiner]
US 20240346256A1 · Qin · 2024 [cited by applicant]
US 20240354567A1 · Duggal et al. · 2024 [cited by applicant]
US 20240370478A1 · Twig et al. · 2024 [cited by applicant]
US 20240370505A1 · Devaux et al. · 2024 [cited by applicant]
US 20240378206A1 · Po · 2024 [cited by applicant]
US 20240394249A1 · Cunningham · 2024 [cited by examiner]
US 20240394251A1 · Brende et al. · 2024 [cited by applicant]
US 20240403367A1 · Dressler, II · 2024 [cited by applicant]
US 20240404687A1 · Bell et al. · 2024 [cited by applicant]
US 20240419705A1 · Kotaru · 2024 [cited by examiner]
US 20240428908A1 · Toscano, III · 2024 [cited by examiner]
US 20250005051A1 · Khosla et al. · 2025 [cited by applicant]
US 20250013636A1 · Romero · 2025 [cited by examiner]
US 20250036773A1 · Chihaia · 2025 [cited by examiner]
US 20250061141A1 · Neervannan et al. · 2025 [cited by applicant]
US 20250061290A1 · Gardner et al. · 2025 [cited by applicant]
US 20250068741A1 · Lafon et al. · 2025 [cited by applicant]
US 20250086215A1 · Kumar · 2025 [cited by applicant]
US 20250094707A1 · Portisch et al. · 2025 [cited by applicant]
US 20250111073A1 · Ho et al. · 2025 [cited by applicant]
US 20250112878A1 · Bayless et al. · 2025 [cited by applicant]
US 20250117386A1 · Agarwal et al. · 2025 [cited by applicant]
US 20250147956A1 · Payani et al. · 2025 [cited by applicant]
US 20250209065A1 · Choi · 2025 [cited by examiner]
CN 112270190A · 2021 [cited by applicant]
CN 112559690A · 2021 [cited by applicant]
CN 111813802B · 2021 [cited by applicant]
CN 111522839B · 2023 [cited by applicant]
CN 117056351B · 2024 [cited by applicant]
CN 115168408B · 2024 [cited by applicant]
CN 113779062B · 2025 [cited by applicant]
CN 114896266B · 2025 [cited by applicant]
EP 3591586A1 · 2020 [cited by applicant]
EP 4428710A1 · 2024 [cited by applicant]
EP 4535197A1 · 2025 [cited by applicant]
KR 102277787B1 · 2021 [cited by applicant]
KR 102345568B1 · 2021 [cited by applicant]
KR 20220109978A · 2022 [cited by applicant]
KR 102737842B1 · 2024 [cited by applicant]
WO WO2021132760A1 · 2021 [cited by applicant]
WO WO2022072844A1 · 2022 [cited by applicant]
Using Natural Language Processing in Order to Create SQL Queries (Year: 2008). [cited by examiner]
Wong et al., “A Survey of Natural Language Processing Implementation for Data Query Systems”, Dec. 12, 2021, 8 pages. [cited by examiner]
Assets.ContentStack.io [online], “Introducing MicroStrategy AI: Generative AI on Trusted Data,” Oct. 2023, retrieved on May 2025, retrieved from URL<https://assets.contentstack.io/v3/assets/bltf8d808d9b8cebd37/bltc0f2f2… [cited by applicant]
Assets.ContentStack.io [online], “MicroStrategy Releases Auto, the Customizable AI Bot That Makes Enterprise Analytics Accessible to Anyone, Building on MicroStrategy AI,” Mar. 2024, retrieved on May 2025, retrieved fro… [cited by applicant]
BigDataWire.com [online], “MicroStrategy Fleshes Out AI-for-BI Strategy, Bets Big On Bitcoin,” Mar. 2024, retrieved on May 2025, retrieved from URL<https://www.bigdatawire.com/2024/03/27/microstrategy-fleshes-out-ai-for… [cited by applicant]
Wikipedia.org [online], “Data model,” available on or before Apr. 12, 2023, via Internet Archive: Wayback Machine URL<https://web.archive.org/web/20230412211016/https:/en.wikipedia.org/wiki/Data_model>, retrieved on May… [cited by applicant]
Wikipedia.org [online], “Database schema,” available on or before Mar. 14, 2023, via Internet Archive: Wayback Machine URL<hhttps://web.archive.org/web/20230314195536/https:/en.wikipedia.org/wiki/Database_schema>, retri… [cited by applicant]
U.S. Appl. No. 18/596,738, filed Mar. 6, 2024, Abhyankar et al. [cited by applicant]
U.S. Appl. No. 18/653,504, filed May 5, 2024, Ojha et al. [cited by applicant]
U.S. Appl. No. 19/228,366, filed Jun. 4, 2025, Courcelle et al. [cited by applicant]
Ai.stackexchange.com [online], “What would be the best AI model to query a database in natural language?,” added Dec. 15, 2023, modified Jan. 24, 2024, retrieved on Jun. 6, 2025, retrieved from URL <https://ai.stackexch… [cited by applicant]
Aws.Amazon.com [online], “Building a conversational business intelligence bot with Amazon Lex,” Nov. 2018, retrieved on Jun. 6, 2025, retrieved from URL <https://aws.amazon.com/blogs/machine-learning/building-a-conversa… [cited by applicant]
Celigo.com [online], “Natural language BI: Query your database with no-code AI solutions,” Jan. 2024, retrieved on Jun. 6, 2025, retrieved from URL <https://www.celigo.com/blog/text-to-sql-access-databases-no-code-ai-so… [cited by applicant]
Chat2db.ai [online], “AI-driven data management platform Over 1 million developers are using Chat2DB,” available on or before Jun. 23, 2024, via Internet Archive: Wayback Machine URL <https://web.archive.org/web/2024062… [cited by applicant]
Chat2db.ai [online], “Chat2DB,” available on or before Nov. 1, 2024, via Internet Archive: Wayback Machine URL <https://web.archive.org/web/20241101193332/https://chat2db.ai/resources/docs/start-guide/getting-started>, … [cited by applicant]
Community.OpenAI.com [online], “Creating a Chatbot using the data stored in my huge database,” Jun. 2023, retrieved on Jun. 6, 2025, retrieved from URL <https://community.Community.OpenAI.com/t/creating-a-chatbot-using-… [cited by applicant]
Community.OpenAI.com [online], “How do i create a custom model for text to sql queries?,” May 2023, retrieved on Jun. 6, 2025, retrieved from URL <https://community.Community.OpenAI.com/t/how-do-i-create-a-custom-model-… [cited by applicant]
Einblick.ai [online], “What is LangChain? Why Use LangChain?,” Mar. 2023, retrieved on Feb. 16, 2024, retrieved from URL <https://www.einblick.ai/blog/what-is-langchain-why-use-it/>, 10 pages. [cited by applicant]
Hong et al., “Next-Generation Database Interfaces: A Survey of LLM-based Text-to-Sql,” Corr, Submitted on Jun. 12, 2024, arXiv:2406.08426v1, 17 pages. [cited by applicant]
Joseph et al., “AskYourDB: An end-to-end system for querying and visualizing relational databases using natural language,” CoRR, Submitted on Oct. 16, 2022, arXiv:2210.08532v1, 9 pages. [cited by applicant]
Locusive.com [online], “Build A Custom AI Chatbot For Your Business Without The Hassles Of A Vector Database,” available on or before Apr. 13, 2024, via Internet Archive: Wayback Machine URL <https://web.archive.org/web… [cited by applicant]
Medium.com [online], “AI Chatbot with your Knowledge base,” Feb. 2024, retrieved on Jun. 6, 2025, retrieved from URL <https://medium.com/databutton/ai-chatbot-with-your-knowledge-base-0390c8c6e5d8>, 19 pages. [cited by applicant]
Medium.com [online], “Ask YourDatabase: A New Plugin for ChatGPT,” Jul. 2023, retrieved on Jun. 6, 2025, retrieved from URL <https://medium.com/@sheldonniu/askyourdatabase-a-new-plugin-for-chatgpt-e390828a3047>, 13 page… [cited by applicant]
Medium.com [online], “Building a RAG System and Conversational Chatbot with Custom Data on your Local Machine,” Feb. 2024, retrieved on Jun. 6, 2025, retrieved from URL <https://medium.com/@vikrambhat2/building-a-rag-sy… [cited by applicant]
Medium.com [online], “Several Outstanding Text2Sql (Chat2Sql) Open Source Projects,” Jul. 2024, retrieved on Jun. 6, 2025, retrieved from URL <https://medium.com/@tubelwj/several-outstanding-text2sql-chat2sql-open-sourc… [cited by applicant]
Pandey et al., “Ensuring Data Accuracy in Text-to-SQL Systems: A Comprehensive Validation Framework,” International Journal of Computer Trends and Technology, Dec. 2024, 72(12):17-24. [cited by applicant]
Seek.ai [online], “Text2SQL: An Overview of Past, Present and Future,” May 2024, retrieved on Jun. 6, 2025, retrieved from URL<https://www.seek.ai/blog/a-survey-of-text-to-sqls-past-present-and-future>, 5 pages. [cited by applicant]
Singh et al., “A Survey of Large Language Model-Based Generative AI for Text-to-SQL: Benchmarks, Applications, Use Cases, and Challenges,” CoRR, Submitted on Jan. 23, 2025, arXiv:2412.05208v2, 7 pages. [cited by applicant]
TTNews.com [online], “Using AI to Chat With Your Database, ” May 2023, retrieved on Jun. 6, 2025, retrieved from URL <https://www.ttnews.com/articles/using-ai-voice-database>, 6 pages. [cited by applicant]
Zhao et al., “Chat2data: An interactive data analysis system with rag, vector databases and llms,” Proceedings of the VLDB Endowment, Aug. 2024, 17(12):4481-4, 4 pages. [cited by applicant]
Zhu et al., “Large Language Model Enhanced Text-to-SQL Generation: A Survey,” CoRR, Submitted on Oct. 8, 2024, arXiv:2410.06011v1, 18 pages. [cited by applicant]
Cited By (2)
US 12,670,160 US 12,694,258