The invention discloses a method for reducing
natural language generation complex
SQL through table mode construction and
SQL conversion. The method comprises the steps that a
database mode is configured in advance, and a request of a user is processed; a
database mode is pre-configured. The method comprises the following configuration steps: 1.1, a user configures connection information of a
database to obtain a read permission of a
target database in the database; and 1.2, reading table mode information from the
target database according to the information configured by the user in the step 1.1, randomly reading two records at the same time, naming the two records as data 1 and data 2 respectively, and storing the data 1 and the data 2 in the database as a table mode. The method for
processing Query of a user by the
system comprises the following steps of: 2.1, retrieving a database mode related to the Query, and retrieving a related table mode from a database; 2.2, retrieving an
SQL (Structured
Query Language) example related to Query; 2.3, prompt word construction; 2.4, generating an SQL (structured
query language) through the LLM model; 2.5,
rewriting the SQL; and 2.6, executing the SQL. The method has the characteristics of more accurate complex query, lower maintenance cost and shorter time consumption.