A natural language interface lets people ask questions about data in everyday language. A language model translates each question into a formal query, a data-processing tool runs that query, and the resulting data answers the question. section 5.1
A practical interface connects four pieces:
- Input: the user’s question, such as “How many games did Activision create?” section 5.2.5
- Instructions: a prompt identifies the target query language and describes the database structure, including tables, columns, and data types. section 5.1
- Translation: the language model produces SQL for relational data or Cypher for graph data. section 5.1
- Execution: a specialized database tool runs the query and returns the answer. section 5.1
From a question to an answer
For a games database, a user can ask, “How many games are stored in total?” The interface generates `SELECT COUNT(*) FROM games;` and returns `(16599,)`. It can continue accepting questions without restarting, execute each translated query, and display both the query and its answer. Because translation can be incorrect, the program catches database errors instead of terminating. section 5.3.4 section 5.3.3
Figure 5.1 A natural language query interface translates questions in natural language into formal queries, taking into account the data structure. Formal queries are then processed on data by a specia- lized tool, generating a query result.
Follow the workflow from a natural-language question through formal query generation and specialized data processing to a query result. section 5.1





