The invention discloses a human resource data
natural language query and
SQL generation method and
system, and relates to the technical field of
SQL generation, and the method comprises the steps: preprocessing a
natural language query text input by a user, and constructing a query
semantic tree; traversing the query
semantic tree to generate a candidate entity set, determining an unambiguous entity through a three-layer
ambiguity resolution mechanism of semantic scoring, service
verification and
cross validation, identifying a composite intention, disassembling the composite intention into a sub-intention sequence, and generating an
SQL operation
instruction set in combination with a preset SQL operation mapping rule; based on the SQL operation
instruction set and the human resource
data association model, determining a data table set and an association path, generating a dynamic calculation logic and structured condition expression, and constructing a structured query skeleton; according to the method, the personalized SQL template is dynamically generated according to the query skeleton, after filling, grammar
verification, strategy optimization and logic consistency
verification are performed, and the optimized SQL statement is output, so that the query accuracy and performance are remarkably improved.