/

/

/

1. Introduction

/

1.4. What Users Can Ask AI2SQL

AI2SQL is designed to make it easy for users to interact with their database using natural language queries. In this section, we'll provide an overview of the types of questions users can ask AI2SQL.

2.1 Basic Queries

AI2SQL can answer simple questions about your data, such as:

  • Show all records from the employees table.

  • How many orders were placed last month?

  • What is the average salary of employees in the finance department?

2.2 Aggregation and Grouping

AI2SQL can perform aggregation and grouping on your data, such as:

  • What is the total revenue generated by each product category?

  • How many customers are there in each country?

  • What is the average order value per month?

2.3 Filtering and Sorting

AI2SQL can filter and sort your data based on specific criteria, such as:

  • Show the top 10 employees with the highest salaries.

  • List all orders placed by a specific customer.

  • Display products with a price above $100.

2.4 Joining Tables

AI2SQL can join tables to answer more complex questions, such as:

  • Show customer information along with their orders.

  • List all employees and their respective departments.

  • Display products and their associated categories.

2.5 Date and Time Functions

AI2SQL can work with date and time data to answer questions, such as:

  • How many orders were placed in the last 7 days?

  • What is the total revenue generated this quarter?

  • Show a list of employees hired within the past year.

2.6 Creating Database Functions

AI2SQL can also help users create and manage database functions. Here are some examples of tasks you can perform using natural language queries:

  • Create a function that calculates the total price of an order, including tax and shipping costs.

  • Define a function to calculate the total sales for a specific date range.

  • Create a function to determine the average customer rating for a given product.

When working with database functions, remember to:

  • Specify the function's name: Clearly indicate the name of the function you want to create or modify.

  • Define input parameters: Provide the required input parameters for the function, including their data types.

  • Describe the function's logic: Explain the logic or calculations that the function should perform using the input parameters.

  • Specify the return value: Indicate the data type of the value the function should return.

2.7 Creating a New Database

AI2SQL can also assist users with creating a new database. To create a new database, provide the following information:

  • The desired name for the new database.

  • The character set and collation settings, if applicable.

  • Any additional options or configurations specific to your database management system.

2.8 Inserting Data

AI2SQL can help users insert data into their database tables. When inserting data, provide the following information:

  • The target table where the data should be inserted.

  • The column names and corresponding values for the new record.

  • Any additional options or constraints, if applicable (e.g., handling duplicates).

For example, you could ask AI2SQL to:

  • Insert a new employee record with specific values for name, title, and hire date.

  • Add a new product with a given name, price, and category.


Keep in mind that creating a new database may require advanced privileges in your AI2SQL account. If you're unsure, check with your account administrator.

Remember that the actual questions AI2SQL can answer will depend on the structure and content of your database. Be sure to explore the capabilities of AI2SQL in the context of your specific data to get the most out of the platform.

Note: To achieve more accurate and relevant results with AI2SQL, it is recommended that you add your database tables to the platform. By doing so, AI2SQL can better understand the structure of your data and provide more tailored responses to your queries. To learn how to add your tables, please follow the instructions in this link.