SQL Server and English Query
English Query provides an Automation API that lets users resolve natural-language questions about the information in a Microsoft® SQL Server™ 2000 database.
Given a definition of the entities and relationships associated with a SQL Server database, English Query translates a natural-language question about data in the database to a set of SQL SELECT statements that can then be executed against the SQL Server database to get the answer.
For example, given a car sales database, an application can send English Query a string containing the question, "How many blue Fords were sold in 1996?"
English Query returns to the application an SQL statement such as:
SELECT COUNT(*)
FROM CarSales
WHERE Make = 'Ford'
AND Color = 'Blue'
AND DATEPART(yy, SalesDate) = '1996'
The application can then execute the SQL statement against the SQL Server database to get a number it can return to the user.
English Query works best with a normalized database. There are two parts to using English Query in an application:
- An administrator defines an English Query project for the database and uses that to compile what is called an English Query application file. The English Query model is what defines the structure of the database to the English Query run-time engine.
An English Query model contains:
- Definitions of entities, which are usually associated with tables and columns of the database.
- Definitions of the relationships between the entities.
- Definitions of entities, which are usually associated with tables and columns of the database.
- The model is defined with a Model Editor and tested with a test tool. The result is saved as an English Query project (.eqp) file. This file is compiled to form the English Query application (.eqd) file.
English Query uses full-text search to generate powerful queries designed to extract data from SQL Server database columns covered by full-text indexes. For more information, see Full-Text Search.
English Query also generates queries to extract data from the OLAP cubes stored in Analysis Services. When used as a front end for Analysis Services, English Query generates the MDX statements required to extract the data from the OLAP cubes. For more information, see Analysis Services in English Query.
English Query is an Automation server that can be called from any Automation application. The Automation server, or run-time engine, exposes an object model API. An Automation application uses the API to load the English Query application file and then send the run-time engine natural-language questions. The run-time engine usually returns an SQL statement or batch that will retrieve the required information from the SQL Server database. Sometimes the run-time engine can provide the answer directly, request clarification, or return an error.