NL2SQL Query Processing Using Child Table Recall
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing NL2SQL process faces low speed and low accuracy due to the large quantity of fields in to-be-queried data tables, especially when performing multi-table queries, affecting the efficiency and accuracy of converting natural language query statements into SQL query statements.
Innovation Solution
A method that narrows the field range by obtaining a child table with a smaller quantity of fields from a to-be-queried data table as input, using a child table recall model to identify candidate data tables and a visual interface for user selection or ranking based on correlation, followed by converting the natural language query statement into an SQL query statement.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If all to-be-queried data tables with large quantity of fields are used as input for NL2SQL model, then comprehensive data coverage is achieved, but conversion speed and accuracy deteriorate
Solution Approach 1:
The patent segments the large to-be-queried data table into multiple child tables based on parent-child relationships. The NL2SQL model processes these smaller child tables individually or in selected combinations, reducing the computational burden while maintaining query accuracy through systematic table selection strategies.
Solution Approach 2:
The patent extracts and identifies relevant child tables from the complete to-be-queried data table structure. By selecting only the necessary child tables that contain fields relevant to the natural language query, the system eliminates unnecessary data processing while preserving conversion accuracy.
2Quantity of substance
If the quantity of fields in to-be-queried data table is large, then data completeness is improved, but field retrieval range expands causing lower efficiency
Solution Approach 1:
The patent applies local quality by focusing the field retrieval process on specific child tables with smaller, relevant field sets rather than processing all fields in the large to-be-queried data table. This localized approach improves retrieval efficiency while maintaining data completeness for the specific query context.
Solution Approach 2:
The patent implements partial action by retrieving fields only from selected child tables that are relevant to the query, rather than processing all fields in the complete data table. This partial processing approach significantly improves efficiency while maintaining sufficient data coverage for accurate query conversion.
3Productivity
If child table recall model is used to identify candidate data tables, then field range is narrowed improving efficiency, but model complexity increases
Solution Approach 1:
The patent implements preliminary action by using the child table recall model to pre-identify candidate child tables before the main NL2SQL conversion process. This preliminary filtering step narrows down the field range early in the pipeline, improving subsequent conversion efficiency while organizing complexity into a manageable preprocessing stage.
Data Source
AI summary
Embodiments of this application relate to the field of artificial intelligence, and provide a natural language query statement processing method and apparatus. The method includes: obtaining a natural language query statement; inputting the natural language query statement and the to-be-queried data table into a child table recall model, to obtain at least one candidate data table; determining a target data table from the at least one candidate data table; and inputting the natural language query statement and the target data table into a natural language to structured query statement model, to obtain a structured query statement. In the foregoing method, a child table with a smaller quantity of fields is obtained, based on the natural language query statement, from the to-be-queried data table as an input of an NL2SQL model, so that efficiency and accuracy of querying for data based on a natural language are improved.


