The invention relates to a
database query method and device based on a large
language model agent and
electronic equipment, and the method comprises the steps: obtaining and analyzing query request information, recognizing a query request intention type, carrying out the problem splitting of the query request information according to the query request intention type, and obtaining sub-query request information; searching and obtaining an
SQL statement corresponding to the sub-query request information in the target
knowledge base according to the category of the query request intention, constructing and generating an
SQL statement prompt word and sending the
SQL statement prompt word to the large
language model when the SQL statement is not searched, executing according to the returned SQL statement to obtain a sub-query result, integrating the sub-query result and obtaining a query result of the query request information, and generating a
data visualization code based on the large
language model, executing and outputting a query result and a
visualization display result thereof. By combining
natural language processing, a large language model and a multi-item optimization technology, the efficiency and
usability of
data query are greatly improved, and non-technical users can conveniently analyze complex data.