TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

SQLite Import

SQLite Import with history, features, advantages, installation, commands, syntax, datatypes, operators, expressions, databases, table, crud operations, clauses, like, glob, limit, and clause, advance sqlite

<< Back to SQLITE

SQLite Import

You can import a CSV file into SQLite table by using sqlite3 tool and .import command. This command accepts a file name, and a table name.

Here, file name is the file from where the data is fetched and the table name is the table where the data will be imported into. In the absence of the table, it will create the table automatically according to the data in CSV file.


CSV file to SQLite table

Let's take an example where we import the content of a CSV file to a table that doesn't exist currently. Let's name it "EMPLOYEE". It will create a table based on the data of CSV file.

.mode csv
.import /Users/TheDeveloperBlog1/Desktop/sqlite/student.csv EMPLOYEE 

Note: .mode csv is used before .import to prevent the command-line utility from trying to interpret the input file text as some other format.

Sqlite Import 1

Now check if the table is created:

Sqlite Import 2

You can see that EMPLOYEE table is created. Now check the data in EMPLOYEE table:

.mode column
SELECT * FROM EMPLOYEE; 
Sqlite Import 3

Note: .mode column is used before SELECT statement to show the data in tabular form and specifies the columns.


Next TopicSQLite Export




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf