Unlock instant, AI-driven research and patent intelligence for your innovation.

A method and device for generating SQL statements based on natural language

A natural language and sentence technology, applied in the field of data processing, can solve problems such as insufficient data analysis and processing capabilities, and achieve the effect of strong data analysis and processing capabilities and wide application prospects

Active Publication Date: 2020-07-14
HANGZHOU SHIPING INFORMATION & TECH
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The object of the present invention is to provide a method and device for generating SQL statements based on natural language for the problem of insufficient data analysis and processing capabilities in the above-mentioned prior art, by converting natural language into SQL statements according to natural language and related table information , so that the corresponding information can be queried from the database, which is convenient for analyzing and processing the newly added data

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A method and device for generating SQL statements based on natural language

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0030] The embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings.

[0031] see figure 1 , the present invention generates the method for SQL statement according to natural language as follows:

[0032] 1) For natural language N, use some sentence vector generation methods to get sentence vector N s .

[0033] 2) For the table descriptions of all the tables in the database to be checked, use the sentence vector generation method to obtain the description vector T of each table i .

[0034] 3) Use the vector correlation calculation method to calculate the description vector T of each table i and natural language sentence vector N s The correlation between, select the top n tables with the highest correlation as candidates, and n is a preset parameter.

[0035] 4) For the natural language N, use the semantic analysis algorithm to convert it into a corresponding SQL template, in the form of "select{agg}([...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

A method and device for generating SQL statements based on natural language, the method comprising: 1) converting natural language N into sentence vector N through a sentence vector generation method s ; 2) use the sentence vector generation method to convert the table descriptions of all tables in the database to be checked into the description vector T of each table i ; 3) Calculate the description vector T of each table i and natural language sentence vector N s 4) Select the top n tables with the highest correlation as candidate tables; 5) Use the semantic analysis algorithm to convert the natural language N into the corresponding SQL template, traverse the selected candidate tables, and convert each candidate table Insert it into the SQL template to obtain the SQL statement list; 6) calculate the confidence degree of the SQL statement list, and select the SQL statement as the matching statement according to the confidence degree. The invention has strong data analysis and processing capabilities, and can query corresponding information from a database.

Description

technical field [0001] The invention belongs to the field of data processing, and in particular relates to a method and a device for generating SQL statements according to natural language. Background technique [0002] With the development of the Internet, new business models are constantly emerging, and there are many new business systems that gather some new data. The traditional mode of data analysis and processing is increasingly unable to cope with the ever-increasing data. The method of generating SQL (Structured Query Language) statements based on natural language can partially meet the related requirements of query and statistics in data processing, without the need for users to be proficient in SQL language or develop corresponding query and statistics functions. Contents of the invention [0003] The object of the present invention is to provide a method and a device for generating SQL statements based on natural language to solve the problem of insufficient da...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F16/242G06F16/2452G06K9/62
CPCG06F16/2433G06F16/24522G06F18/22
Inventor 王世晞张亮刘涛
Owner HANGZHOU SHIPING INFORMATION & TECH