Created
November 8, 2023 03:41
-
-
Save hochun836/529ac2234c386180974fa28e0163d269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base | |
NOTE: download 'sqlite3.exe' for windows | |
sqlite-tools-win-x64-3440000.zip // a bundle of command-line tools (sqlite3.exe, sqldiff.exe, sqlite3_analyzer.exe) | |
=> ref: https://sqlite.org/download.html | |
# cmd | |
sqlite3 -help | |
sqlite3 -version | |
sqlite3 <db-name.db> // enter sqlite shell | |
sqlite3 <db-name.db> <sql> | |
sqlite3 test.db | |
sqlite3 test.db "select * from tbl1;" | |
sqlite3 test.db "select * from tbl1;" -newline <sep> // set output row separator (default: '\n') | |
sqlite3 test.db "select * from tbl1;" -separator <sep> // set output column separator (default: '|') | |
sqlite3 test.db "select * from tbl1;" -box // set output mode to 'box' | |
sqlite3 test.db "select * from tbl1;" -column // set output mode to 'column' | |
sqlite3 test.db "select * from tbl1;" -csv // set output mode to 'csv' | |
sqlite3 test.db "select * from tbl1;" -html // set output mode to 'html' | |
sqlite3 test.db "select * from tbl1;" -json // set output mode to 'json' | |
sqlite3 test.db "select * from tbl1;" -line // set output mode to 'line' | |
sqlite3 test.db "select * from tbl1;" -list // set output mode to 'list' | |
sqlite3 test.db "select * from tbl1;" -markdown // set output mode to 'markdown' | |
sqlite3 test.db "select * from tbl1;" -quote // set output mode to 'quote' | |
sqlite3 test.db "select * from tbl1;" -table // set output mode to 'table' | |
sqlite3 test.db "select * from tbl1;" -tabs // set output mode to 'tabs' | |
=> ref: https://sqlite.org/quickstart.html | |
=> ref: https://sqlite.org/cli.html | |
# sqlite shell (start with 'sqlite>') | |
.help | |
.show // show the current values for various settings | |
.databases // list names and files of attached databases | |
.tables // list names of tables | |
.tables <pattern> // list names of tables matching like pattern | |
.quit // exit this program | |
.exit // exit this program | |
ctrl + c // exit this program | |
create table tbl1(one text, two int); | |
insert into tbl1 values('hello!',10); | |
insert into tbl1 values('goodbye', 20); | |
select * from tbl1; | |
# [note] gui | |
- SQLiteStudio (https://github.com/pawelsalawa/sqlitestudio) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment