Skip to content

AIV SQL Buddy

AIV SQL Buddy is an intelligent SQL generation tool that converts natural language queries (NLP) into SQL statements. This tool is designed to assist users in writing SQL queries with ease by translating their plain English requests into accurate SQL queries. It also allows users to build on previous queries if the context is related and offers advanced options for table selection and context management.

Key Features

Image

  1. Table and View Selection: Before writing SQL queries, you can select the specific table or view on which you want to execute the query. This ensures that AIV SQL Buddy generates queries tailored to the selected database objects.

  2. Natural Language to SQL Conversion: Simply input a plain English request, and AIV SQL Buddy will generate the corresponding SQL query.

  3. Contextual Query Expansion: If the next query is related to the previous one, AIV SQL Buddy will intelligently expand the SQL query to include the new conditions.

    Example:

    • Tables Used: products, orderdetails, orders, customers
    • Input 1: “Display the names of the products.”
    • Output 1:
      SELECT productName 
      FROM products
    • Input 2: “Where the quantity ordered is greater than 50.”
    • Output 2:
      SELECT productName 
      FROM products 
      WHERE quantityInStock > 50
    • Input 3: “Show the product names and their corresponding order numbers along with the customer names.”
    • Output 3:
      SELECT products.productName, orders.orderNumber, customers.customerName
      FROM products
      JOIN orderdetails ON products.productCode = orderdetails.productCode
      JOIN orders ON orderdetails.orderNumber = orders.orderNumber
      JOIN customers ON orders.customerID = customers.customerID
      WHERE products.quantityInStock > 50
  4. Initiate New Chat: If you want to start a new conversation or create a completely new SQL query without reference to previous queries, you can use the “Initiate New Chat” feature. This clears the current context and starts a fresh session.

    • Step 1: Click “Initiate New Chat.”
    • Step 2: Input a new query, and AIV SQL Buddy will treat it as a new request.
  5. Query History: AIV SQL Buddy maintains a history of queries and responses. Users can review previous queries and outputs, facilitating the building upon or refining of past queries. This history is useful for tracking workflow and making iterative improvements to SQL statements. Additionally, users can rename or delete entries in the query history to better manage and organize their workflow.

  6. Copy Results: The results of generated SQL queries can be easily copied to the clipboard for use in other applications or for further processing. This feature allows users to quickly transfer the SQL output or results into their preferred SQL client or documentation.

  7. Publish Results: The result can be pushed directly from AI Buddy to Dataset SQL textarea by clicking on the publish button.

  8. Speech to Text: Users can convert spoken language into queries. Simply speak the desired query, and AIV SQL Buddy will transcribe the speech into text and generate the corresponding SQL query. This feature provides a hands-free way to create SQL statements and enhances accessibility.

Steps to Utilize the AIV SQL Buddy

  1. Access the Tool: Click on the AI SQL Buddy button in the top-right corner of the Create Dataset dialog box. Image

  2. Select Table/View: Choose the table or view name from the dropdown menu, as shown in the figure below. Image

  3. Add SQL Prompt: After selecting the products table from the dropdown, click on the text area to add your SQL prompt, as illustrated in the figure below. Image

    Example: Add the following example to generate the SQL query.

    • Input: “Display the names of the products.”
    • Output: SELECT productName FROM products

Image

  1. Apply the Query: Apply the generated SQL query to the dataset by clicking the publish icon in the Result text, as shown in the figure below. Image

  2. Add to Dataset Query Pallet: Once you click the publish button, the query will be added to the dataset query pallet, as shown in the figure below. Image