Some very useful SQLite command summaries _sqlite

Source: Internet
Author: User
Tags sqlite

Show Table structure:

Copy Code code as follows:

sqlite>. Schema [table]

Get all tables and views:
Copy Code code as follows:

SQLite > Tables

Gets the list of indexes for the specified table:
Copy Code code as follows:

SQLite > indices [table]

To export a database to a SQL file:
Copy Code code as follows:

SQLite > output [filename]
SQLite > Dump
SQLite > Output stdout

To import a database from a SQL file:
Copy Code code as follows:

SQLite > read [filename]

Format output data to CSV format:
Copy Code code as follows:

SQLite >.output [Filename.csv]
SQLite >.separator,
SQLite > select * from Test;
SQLite >.output stdout

To import data from a CSV file into a table:
Copy Code code as follows:

SQLite >create table newtable (ID integer primary key, value text);
SQLite >.import [Filename.csv] NewTable

Back up the database:
Copy Code code as follows:

/* Usage:sqlite3 [Database]. dump > [FileName] * *
Sqlite3 mytable.db. Dump > Backup.sql

To recover a database:
Copy Code code as follows:

/* Usage:sqlite3 [Database] < [filename] * *
Sqlite3 Mytable.db < Backup.sql

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.