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
  • Uploading SQL Schema Files
  • How to Upload a SQL Schema File
  • Important Notes
  • Data Privacy and Schema-Only Uploads
  • Sample DDL Format
  1. 3. Managing Tables

3.1. Importing tables using DDL

Previous3. Managing TablesNext3.2. Manually adding tables

Last updated 10 months ago

Uploading SQL Schema Files

Our SQL generator tool allows you to import your existing SQL schema files, such as DDL (Data Definition Language) scripts. This feature enables you to quickly integrate your database structure into the tool for further manipulation or analysis.

How to Upload a SQL Schema File

  1. Navigate to the "Upload SQL Schema File" screen in the tool.

  2. You'll see a form with the following elements:

    • A text input field labeled "File Name*"

    • An upload area with the message "Click to upload a SQL file."

    • A "Finish" button at the bottom

  3. Enter a name for your file in the "File Name" field. This doesn't have to match the actual filename, but should be descriptive. For example, you might enter "customers" for a schema related to customer data.

  4. Click on the upload area. This will open a file browser on your computer.

  5. Select the SQL file you wish to upload. The tool accepts SQL files containing schema definitions, typically with extensions like .sql, .ddl, or .txt.

  6. Once your file is selected, it will appear in the upload area.

  7. Click the "Finish" button to complete the upload process.

Important Notes

  • Ensure your SQL file contains valid DDL statements.

  • The tool currently supports [list supported SQL dialects, e.g., MySQL, PostgreSQL, etc.].

  • There may be a file size limit. If you encounter issues with large files, consider splitting them into smaller schema files.

  • After upload, you can [describe next steps, e.g., "view your schema in the tool", "modify the schema using our visual editor", etc.].

Data Privacy and Schema-Only Uploads

Important: When uploading your SQL schema file, please ensure it contains only the structure of your database (tables, columns, relationships, etc.) and not any actual data. The tool is designed to work with database schemas, not with the data itself. This approach helps maintain data privacy and security.

  • Include only CREATE TABLE, ALTER TABLE, and other structural SQL statements.

  • Omit any INSERT, UPDATE, or other data manipulation statements.

  • Remove any sensitive information such as user credentials or connection strings that might be present in comments.

By uploading only the schema, you can safely use the tool without risking exposure of sensitive or personal data.

If you encounter any issues during the upload process, please check our troubleshooting guide or contact our support team.

Sample DDL Format

To help you understand what your SQL schema file should look like, here's a sample DDL format:

-- Create Customers table
CREATE TABLE Customers (
    CustomerID INT PRIMARY KEY,
    FirstName VARCHAR(50),
    LastName VARCHAR(50),
    Email VARCHAR(100) UNIQUE,
    PhoneNumber VARCHAR(20)
);

-- Create Orders table
CREATE TABLE Orders (
    OrderID INT PRIMARY KEY,
    CustomerID INT,
    OrderDate DATE,
    TotalAmount DECIMAL(10, 2),
    FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);

-- Create Products table
CREATE TABLE Products (
    ProductID INT PRIMARY KEY,
    ProductName VARCHAR(100),
    Price DECIMAL(8, 2),
    StockQuantity INT
);

-- Create OrderDetails table
CREATE TABLE OrderDetails (
    OrderDetailID INT PRIMARY KEY,
    OrderID INT,
    ProductID INT,
    Quantity INT,
    UnitPrice DECIMAL(8, 2),
    FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
    FOREIGN KEY (ProductID) REFERENCES Products(ProductID)
);

-- Add an index
CREATE INDEX idx_customer_email ON Customers(Email);