AI2sql Docs
Go to AppContact
  • 1. Introduction
    • 1.1. What is AI2SQL?
    • 1.2. Key features of AI2SQL
    • 1.3. How to get started with AI2SQL
    • 1.4. What Users Can Ask AI2SQL
  • 2. AI2SQL Dashboard
    • 2.1. Accessing the dashboard
    • 2.2. Generating SQL based on predefined datasets
    • 2.3. Exploring sample queries and use cases
  • 3. Managing Tables
    • 3.1. Importing tables using DDL
    • 3.2. Manually adding tables
    • 3.3. Editing, Updating, and Deleting Table Information
    • 3.4. Importing Database Schema via CSV
  • 4. AI2SQL Workspace
    • 4.1. Navigating the workspace
    • 4.2. Generating SQL for specific database engines
    • 4.3. Selecting tables for SQL generation
    • 4.4. Saving and organizing queries in the workspace
  • 5. Formatting SQL
    • 5.1. Accessing the SQL formatter
    • 5.2. Customizing formatting options
    • 5.3. Applying formatting to your SQL queries
  • 6. SQL Fixer
    • 6.1. Identifying SQL errors with SQL Fixer
    • 6.2. Understanding common SQL error messages
    • 6.3. Resolving SQL errors using AI2SQL's suggestions
    • 6.4. Handling Long SQL Queries
  • 7. Formula Generator
    • 7.1. Overview of Formula Generator
    • 7.2. Excel, Google Sheets, and regex formula translation
    • 7.3. Power BI DAX formula translation
    • 7.4. Airtable formula translation
    • 7.5. Using Formula Generator to enhance SQL queries
  • 8. CSV Analyzer
  • 9. Database Connectors
    • 9.1. Supported database connectors
    • 9.2. Setting up database connections (MySQL, SQL Server, or PostgreSQL)
    • 9.2.1. AI2sql Oracle Cloud Connector
    • 9.3. Setting up MongoDB Connectors
    • 9.4. Google BigQuery Setup and Service Account Key Creation
    • 9.5. Generating SQL queries for connected databases
    • 9.6. Setting up Snowflake Connectors
    • 9.7. Troubleshooting AI2sql Connector Issues: A Comprehensive Checklist
    • 9.8. Requesting new database connectors
    • 9.9. System Security Overview
  • 10. Dataset Questions Generation
  • 11. AI2SQL ChatGPT Plugin User Guide
    • 11.1. Introduction
    • 11.2. Getting Started
    • 11.3. Obtaining Your Token
    • 11.4. Using Your Token
    • 11.5. Connecting Your MSSQL (SQL Server) Database
    • 11.6. Connecting Your MySQL Database
    • 11.7. Connecting Your PostgreSQL Database
    • 11.8. Generating SQL Queries
    • 11.9. Troubleshooting
  • 12. Troubleshooting and Support
    • 9.1. Common issues and solutions
    • 12.2. Chat Support
    • 12.3. Contacting AI2SQL support
    • 12.4. Community resources and forums
  • 13. Templates
    • 13.1. Custom Template Creation
    • 13.2. Save the Template
    • 13.3. Generate SQL Using Template
  • 14. AI2sql: SQL Generation from Database ER Diagrams
    • 14.1. Introduction
    • 14.2. SQL Generation Process
    • 14.3. Troubleshooting & FAQs
  • 15. AI2sql API Integration
  • 16. AI2SQL Dictionary Template
  • 17. AI2sql GPTs
    • 17.1. Getting Started
    • 17.2. Obtaining Your Token
    • 17.3. Connecting Your MySQL Database
  • 18. Connecting Your Local Database
  • 19. SQL File Uploader
    • 19.1 Generating SQL queries
Powered by GitBook
On this page
  • CSV Analyzer
  • How It Works
  • Using the CSV Analyzer
  • Query Tips
  • Features
  • Best Practices
  • Troubleshooting
  • Limitations
  • Sample CSV for E-commerce

8. CSV Analyzer

Previous7.5. Using Formula Generator to enhance SQL queriesNext9. Database Connectors

Last updated 9 months ago

CSV Analyzer

The CSV Analyzer is a powerful tool that allows you to run SQL-like queries directly on your CSV files without the need for a database setup. This tool is perfect for quick data analysis, especially when working with large datasets in CSV format.

How It Works

  1. Upload your CSV file to the tool.

  2. Enter a query in natural language or SQL-like syntax.

  3. The tool generates and runs the appropriate SQL query on your CSV data.

  4. View the results directly in the output window.

Using the CSV Analyzer

Step 1: Upload Your CSV File

  1. Locate the "CSV File*" section.

  2. Click on the upload icon (↑) to select your CSV file.

  3. Once uploaded, you'll see the file name displayed (e.g., "csv upload ecommerce").

Step 2: Enter Your Query

  1. Find the "Enter Your Query*" text box.

  2. Type in your query using natural language or SQL-like syntax.

  3. Example query: "Get total sales by product category and top salesperson in that category for 2023."

Step 3: Generate and View Results

  1. Click the "Generate" button to process your query.

  2. The results will appear in the "Output" section on the right side of the screen.

Query Tips

  • Use natural language for simple queries.

  • For more complex analysis, you can use SQL-like syntax.

  • Include specific column names from your CSV if you know them.

  • Specify time periods, groupings, or aggregations as needed.

Features

  • Direct CSV analysis without database setup

  • Natural language query processing

  • SQL-like query support

  • Real-time results generation

  • Large CSV file handling

Best Practices

  1. Ensure your CSV file is properly formatted with headers.

  2. For large files, be patient as processing may take a moment.

  3. Start with simple queries and gradually increase complexity.

  4. Use specific column names and conditions for more accurate results.

Troubleshooting

If you're not getting the expected results:

  • Check that your CSV file is correctly formatted.

  • Verify that column names in your query match those in your CSV.

  • Ensure your query logic aligns with the data structure.

  • For complex queries, try breaking them down into simpler parts.

Limitations

  • The tool processes data in-memory, so extremely large files may be slow or fail to process.

  • Complex joins or subqueries might not be supported.

  • Some advanced SQL features may not be available.

Sample CSV for E-commerce

To help you get started, here's a sample CSV structure for an e-commerce dataset. You can use this as a reference when formulating your queries.

Sample CSV Structure:

order_id,date,customer_id,product_id,product_name,category,quantity,unit_price,total_price,salesperson
1001,2023-01-15,C001,P101,Laptop X1,Electronics,1,999.99,999.99,John Doe
1002,2023-01-16,C002,P201,Running Shoes,Sports,2,79.99,159.98,Jane Smith
1003,2023-01-16,C003,P102,Smartphone Y2,Electronics,1,599.99,599.99,John Doe
1004,2023-01-17,C001,P301,Mystery Novel,Books,3,14.99,44.97,Alice Johnson
1005,2023-01-18,C004,P202,Yoga Mat,Sports,1,29.99,29.99,Jane Smith
1006,2023-01-19,C002,P103,Tablet Z3,Electronics,1,349.99,349.99,John Doe
1007,2023-01-20,C005,P302,Cookbook,Books,2,24.99,49.98,Alice Johnson
1008,2023-01-21,C003,P203,Dumbbell Set,Sports,1,89.99,89.99,Jane Smith
1009,2023-01-22,C001,P104,Smartwatch A1,Electronics,1,199.99,199.99,John Doe
1010,2023-01-23,C004,P303,Science Fiction Trilogy,Books,1,39.99,39.99,Alice Johnson

Sample Queries:

  1. Get total sales by product category: "Show me the total sales for each product category"

  2. Find the top-selling product: "What is the best-selling product by quantity?"

  3. Calculate sales by salesperson: "Calculate total sales for each salesperson"

  4. Analyze daily sales: "Show daily total sales for the month of January 2023"

  5. Identify top customers: "Who are the top 3 customers by total purchase amount?"

Remember, this tool is designed for quick analysis and may not replace a full-fledged database for very complex operations. However, it's incredibly useful for rapid data exploration and analysis of CSV files.