Importing Data into a Table in SQLite
Using Firefox's SQLite Manager

To import a dataset into a relational table in SQLite, do the following:

  1. Create a CSV file for your dataset in which the first row is a row containing the attribute names.

    If you don't already have the necessary CSV file, one way to create it is to open/import your dataset in Excel, add a row with the attribute names at the top of the file if there isn't already one there, and then use File->Save As to save the data as a CSV file.

  2. Start up Firefox's SQLite Manager by clicking on the orange menu button in the upper left-hand corner of Firefox and choosing Web Developer -> SQLite Manager. (Firefox may ask you if you want to open the last used database. If it does, click Cancel.)

  3. Choose the Database -> New Database menu option to create a database file for your data. Choose an appropriate name for the database file (e.g., project) and put it in the folder that you're using for your work on the project.

  4. Choose the Database -> Import menu option, which will open the Import Wizard tab. Click the Select File button, and then find and select the CSV file that you created in step 1.

  5. If necessary, modify the default name listed for the table. This is the name that you will use in the FROM clause of your SQL commands.

  6. Click the checkbox next to the words First row contains column names, which will cause SQLite Manager to use the names in the first line of the CSV file as the names of the attributes in the table.

  7. Click the OK button at the bottom of the tab to create the table. This will pop up a dialog box informing you that a new table will be created, and asking you if you want to modify the new table. Click OK.

  8. A new Create Table dialog box should open showing the names of the columns in the tables. Modify the definitions of the columns by choosing an appropriate data type for each column. (Note: selecting a primary key for the table is not required. If you do not select one, SQLite Manager will add a rowid column to serve as the primary key.)

  9. Once you have chosen data types for all of the columns, click the OK button, and then click OK again to confirm that you want to import the data.

  10. You should now be ready to work with your data in SQLite Manager by entering SQL commands in the Execute SQL tab. You can also browse through the contents of the table using the Browse & Search tab.