SqLite cmd command View sqlitedatabase

Source: Internet
Author: User
Tags clear screen sqlite

Introduction:

Always use eclipse to develop Android. Under Ddms, there is an explorer that can view data for each application under Data/data, including database. But this method can only be exported to see, very inconvenient, and then think directly in the ADB shell using the SqLite3 command to see more convenient.

CMD Command Basics:

Common commands:

Dir Display file list

CLS Clear Screen

CD Switch Directory

LS display file list, cmd invalid, adb valid

Windows App Command, enter the application name directly to open the program:
(List several)

MSPaint Open a drawing board

Notepad Open Notepad

Explorer Open Resource Manager

Calc Startup Calculator

Command shortcut keys:

ESC: Clears the current command line;

F7: Displays the command history, gives all previously entered commands in the form of a graphical list window, and optionally executes the command again using the UP and DOWN ARROW keys.

F8: Searches the history of the command, loops through all the commands that were entered, until the ENTER key is pressed;

F9: Selects the command by number, asks you to enter the number of the command (starting at 0) in a graphical dialog box, and displays the command on the screen

Ctrl+h: Delete one character to the left of the cursor;

CTRL + C Ctrl+break, Force abort command execution

Ctrl+m: Indicates the Enter confirm key;

ALT+F7: Clears all previously entered command history

Alt+printscreen: Intercepts the contents of the current command window on the screen.

Examples of SQLite commands:

Switch to the relevant directory first

ADB shell

CD data/data/com.example.demo1023/databases

LS will show all databases under the current application:

Sqlite3 Db1.db will go into the DB1.DB database to execute the relevant sqlite3 commands.

. Help; View sqlite3 Settings command assistance:

Sqlite>. Help

. Help

. backup? CBX File Backup DB (default "main") to file

. Bail on|  OFF Stop after hitting an error. Default OFF

. databases List names and files of attached databases

. Dump? TABLE?      ... Dump the database in an SQL text format

If TABLE specified, only dump tables matching

Like pattern TABLE.

. Echo on| Off Turn command echo on or off

. Exit Exit this program

. Explain? on|      OFF? Turn output mode suitable for EXPLAIN on or off.

With no args, it turns EXPLAIN on.

. Header (s) on| Off Turn display of headers on or off

. help Show this message

. import FILE TABLE Import data from file to table

. Indices?       TABLE? Show Names of all indices

If TABLE specified, only show indices for tables

Matching like pattern TABLE.

. log File|off Turn logging on or off. FILE can be stderr/stdout

. Mode mode?     TABLE? Set output mode where mode is one of:

CSV comma-separated values

Column left-aligned columns. (see. width)

HTML HTML <table> Code

Insert SQL INSERT statements for TABLE

Line one value per line

List Values delimited by. Separator string

Tabs tab-separated values

Tcl TCL list elements

. nullvalue string Print string in place of NULL values

. Output FILENAME Send output to FILENAME

. Output stdout Send output to the screen

. prompt MAIN CONTINUE Replace the standard prompts

. Quit Exit This program

. read FILENAME Execute SQL in FILENAME

. Restore? Db? File Restore content of DB (default "main") from file

. Schema?        TABLE? Show the CREATE statements

If TABLE specified, only show tables matching

Like pattern TABLE.

. Separator STRING Change separator used by output mode and. Import

. Show show the current values for various settings

 


Common sqlite Settings Command description:

. Tables: Lists all table names for the current database

. exit: Exit the current Sqlite3 command

. Headers on/OFF: whether to display column names

. Mode csv/column(best view)/html/insert/line/list/tabs: Table display style

. Show: Displays parameters for all settings

Common SQLite Statement Description: New additions and deletions to investigate

CREATE TABLE User (_id integer PRIMARY keyautoincrement,name VARCHAR, price integer);

SELECT * from Teachers; Displays the entire sheet of teachers.

INSERT into Teachers VALUES (1, ' Alice ', +, ' CHN '); Insert

DELETE from Teachers WHERE age>30; Delete

Attention:

The SQLite command for SQL statements must end with ";"!

If the end does not hit ";", the cmd command line appears "...>", just hit ";".

SqLite cmd command View sqlitedatabase

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.