How To Use The SQLite Dump Command
In this section, we will learn about the syntax and the working procedure of the DUMP dot command.
As mentioned earlier, the DUMP command is a Dot-Command used in SQLite3, so it is used with a preceding dot.
Syntax:
.dump <table_name> [OPTIONAL]
Explanation:
The <table_name> after the DUMP command must be provided whenever the user want to just dump a single Table and not the entire Database. In other times, it is not necessary to provide anything after the DUMP command.
If we use the .dump command singularly, then all the SQL statements used will be given as output in the same Command Line, it will not be saved anywhere.
To understand the DUMP command in more depth we need a 2 table on which we will perform queries. Here we have table called Employees and Students.
After inserting data into the table, Our table looks:
Employees Table:
Students Table:
Now, if we use the dump command now, without mentioning anything else, then all the SQL statements used to create and populate the table will be given as output.
.dump
Output:
Explanation: Using the DUMP dot command, it alone returns all the commands used till now to create and populate the table. It returns the output as a transaction, that’s why the BEGIN TRANSACTION and COMMIT is being displayed here which is not required while writing the actual commands.
SQLite Dump Command
SQL stands for Structured Query Language, which is the common language (with minor changes) used to manipulate relational databases. It is used to create, store, retrieve, and manipulate databases and tables. SQLite is a lightweight version of SQL with some major changes, it doesn’t have a separate server, it is not a common language, and it can’t connect with databases like Oracle or MySQL server.
In this article, we will learn about DUMP Command in SQLite in depth along with its examples, practical implementations, and so on.
Contact Us