Convert SQL to SQLite in an easy way?

12,176

Okay, now it's a little clearer: You want to take an existing MySQL file and translate it into its SQL Lite equivalent.

There are two parts to this process:

  1. Translate the DDL from one SQL database to another (DDL == "Data Definition Language")
  2. Migrate data from one schema to another.

Every SQL vendor starts with ANSI SQL and adds in their own proprietary syntax. So you'll have to create a SQL Lite schema (tables, columns, indexes, etc) from the MySQL definition.

The data migration process is called ETL ("Extract-Transform-Load"). You might have to massage some of that data from MySQL to get it into SQL Lite.

The best scenario would be to export your MySQL data into a .csv file, create the table in SQL Lite, then import the .csv file.

Share:
12,176
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    My question: has someone a super-easy way to convert a SQL-file in SQLite?

  • Admin
    Admin over 13 years
    Thanks 100times! That sounds easy :)
  • Don
    Don over 13 years
    Just to add to the subject... there are DB abstraction layers like ADODB that can be used to write your SQL in a standard way so it can be run in different envirionments. EG: you could move from MySQL to Oracle by changing a connection script, and not have to rewrite your queries. Don't know if it supports SQL-Lite, but something to think about if you're moving platforms often...
  • Admin
    Admin over 13 years
    thanks duffymo, just one more question: is there a better way to create a sqlite.db, than just using the terminal?... I have a gigantic database...
  • duffymo
    duffymo over 13 years
    What do you mean by "gigantic"? Number of tables/columns or amount of data stored in the schema? In both cases, I'd recommend that you script the creation of the schema and the database. If by "better way" you mean something that will allow you to do it without effort, the answer is "no". You'll just have to pick up a shovel and get to work.