Natural Language-to-SQL Based on Relationship Extraction
Wenjun Wan, Quansheng Dou, Xiaoling Zhou, Ping Jiang, Bin Zhang · 2019
Synthesizing SQL query from a natural language with nested conditional statements is a long-standing problem. In this work, we propose a novel approach, RE-SQL, which based on relation extraction. We first set four types of relational connections are defined to represent the SQL syntax structure. Then, we propose a sequence-set model. The model receives two inputs: Natural language description containing an entity pair, table features. The output of the model includes the connection relationships of the entity pairs and the SQL semantics of the entities in the entity pair. By predicting different entities in natural language problems, we get a weighted undirected graph that is highly consistent with the SQL grammar. In the real estate information query task, our method achieves an accuracy rate of 74.35% on the nested query questions.