Translating and Executing Natural Language Queries

Once your AI Profile has been set on a connection, you can execute natural language queries by executing a statement such as:

SELECT AI <natural language query>

For example (if using the HR schema):

SELECT AI What are the departments and where are they located;

SELECT AI Rank the departments by how many employees work in each department;

SELECT AI Who works in the IT department;

You may wish to follow a workflow where you first translate the natural language to SQL, inspect it, and (optionally) edit the SQL before executing it.

  1. Use the SHOWSQL option in your SELECT statement.

    For example:

    SELECT AI SHOWSQL What are the departments and where are they located;
  2. Execute the statement and view the proposed SQL in the output window.

  3. Paste the SQL into the SQL editor.

  4. Modify if needed, then execute it.

Aside from the SHOWSQL option, there are many other options available such as EXPLAINSQL and NARRATE.

See Also:

Use AI Keyword to Enter Prompts for more information