

#Download sqlite terminal code
>sqlite3 -header -csv c:/sqlite/chinook.db " select * from tracks " > tracks.csv Code language: SQL (Structured Query Language) ( sql ) If you check the data.csv file, you will see the following output.īesides using the dot-commands, you can use the options of the sqlite3 tool to export data from the SQLite database to a CSV file.įor example, the following command exports the data from the tracks table to a CSV file named tracks.csv. The following commands select data from the customers table and export it to the data.csv file.

#Download sqlite terminal how to
In this tutorial, I explained how you can install sqlite3 in Ubuntu and how you can create a database for you.Summary: in this tutorial, you will learn how to export SQLite database to a CSV file. For example, here's the database that I created recently: Once done, all you need to do is execute the following command and it will start the sqlite browser: sqlitebrowser &įrom here, you can create a new database or work with the old one. To install the sqlite browser, you will need to execute the following command: sudo apt install sqlitebrowser The sqlite database browser is a GUI utility that lets you handle almost all the operations related to the database without going through the terminal (I will still advise you to embrace the terminal) Want to know how? Here's the bonus from my side! Bonus: Install the Sqlite Database browser in Ubuntu desktop mode columnīut this can also be done using GUI. To verify whether you have successfully added the data, you can list the contents of the table using the following: SELECT * FROM Team Īnd if you want to enable headers and separate the output with columns, use the following command. Here, I will add the data of three team members: insert into Team(Name, age) VALUES ('Tom',25),('Mark',40),('Steve',35) Next, you will have to insert data respective to the data fields that you've just created. Now, here, I will create a table named Team: CREATE TABLE Team(Name String,age Int) To make sure you are dealing with the right database, you can execute the following in sqlite prompt to know the database you're dealing with. Here, I created a database named LU inside my home directory: sqlite LUĪnd it will get you into the sqlite prompt: To create a database, you'd need to append the name with a relative path to the sqlite3 command: sqlite3 /path/to/file

Once you are done with the installation, you can use the following command to check the installed version: sqlite3 -versionĪnd if you get similar output, it means, the sqlite3 has been installed successfully! Create Sqlite3 database in Ubuntu The sqlite3 is available in the default repository of Ubuntu and can easily be installed with the following command: sudo apt install sqlite3 So in this tutorial, I will show you how you can install sqlite3 and how to create a simple table in Ubuntu How to install and use Sqlite3 on Ubuntu
