Sqlite Creating Database & Csv Import
Creating database
Open the terminal and type;
sqlite3 sampledatabase
Importing CSV
Open terminal and start sqlite3;
sqlite3
change mode to csv;
sqlite> .mode csv
Import the csv file;
sqlite> .import /Users/username/Desktop/directory/file.csv import_table_name
Note that you should specify the name of the table which you want to import csv (import_table_name).
Creating Table
CREATE TABLE table_name (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
content_must TEXT NOT NULL,
content_might TEXT
);
Leave a comment