Text-to-SQL Chat Using Schema Retrieval for Accurate Queries

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Interacting with SQL databases can be challenging due to complex query requirements and the need for specialized knowledge, making it difficult for users to effectively access and modify data without writing SQL code.

Innovation Solution

A computing system utilizing generative artificial intelligence to process natural language questions, generating SQL code automatically based on database schemas and user queries, allowing for interaction through a chat interface without requiring programming knowledge.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If users directly write SQL code to interact with databases, then data access precision and control are improved, but ease of operation deteriorates due to complex query requirements and specialized knowledge needed

Engineering Contradiction:
Improvedata access precisionVSAvoidease of operation
Core Design Contradiction:
Measurement precisionVSEase of operation

Solution Approach 1:

The patent introduces a natural language processing intermediary layer that translates user-friendly natural language queries into precise SQL code. This intermediary system includes language understanding modules that parse intent, schema linking modules that map concepts to database structures, and SQL generation modules that produce accurate queries, thereby maintaining data access precision while eliminating the need for users to learn SQL syntax

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent replaces the mechanical system of manual SQL code writing and execution with an automated intelligent system. Instead of users mechanically constructing SQL statements according to database schemas, the system automatically generates and executes SQL code based on natural language input, substituting the manual mechanical process with an automated AI-driven process that maintains precision while improving ease of operation

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Ease of operation

If SQL code is automatically generated from natural language, then ease of operation is improved, but device complexity increases due to multiple processing modules and systems

Engineering Contradiction:
Improveease of operationVSAvoidsystem complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The patent segments the complex code generation task into distinct functional modules: natural language processing module, schema analysis module, query generation module, and execution module. Each module handles a specific aspect of the translation process, making the overall system more manageable and maintainable despite the increased complexity required to achieve automated SQL generation

Inventive Principle:
Principle #1Segmentation

3Manufacturing precision

If comprehensive database schemas are provided to ensure accurate SQL generation, then manufacturing precision is improved, but information overload increases making it harder for users to identify relevant tables

Engineering Contradiction:
ImproveSQL generation accuracyVSAvoidinformation overload
Core Design Contradiction:
Manufacturing precisionVSLoss of information

Solution Approach 1:

The patent performs preliminary schema analysis and table relevance assessment before generating SQL code. The system pre-processes the database schema to identify and prioritize relevant tables and columns based on the natural language query context, preparing a filtered and organized representation that reduces information overload while maintaining the precision needed for accurate code generation

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS20260044500A1Computing systems and methods for a text-to-SQL generative artificial intelligence chat
Publication Date: 2026.02.12 THE TORONTO DOMINION BANK
  • US20260044500A1 patent drawing
  • US20260044500A1 patent drawing
  • US20260044500A1 patent drawing

AI summary

Systems and methods are provided for processing a natural language question using structured query language (SQL). A computing system receives a natural language question; generates a prompt that comprises the natural language question and a database schema corresponding to a database; processes, using a retrieval system, the prompt to identify one or more tables in the database, the one or more tables relevant to the natural language question; generates using the retrieval system, an augmented prompt that comprises the natural language question, the database schema, and one or more identities of the one or more tables; generates, using a SQL large language model (LLM), a set of SQL code based on the augmented prompt; initiates executing the SQL code on the database and receiving a result; generates a result message using the result; and provides the result message responsive to the natural language question.