SQLite: Difference between revisions
iwu Tag: visualeditor |
add other examples |
||
Line 1: | Line 1: | ||
List all tables<syntaxhighlight lang="sqlite3"> | List all databases and related files | ||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .databases | |||
</syntaxhighlight> | |||
Show schemas of all tables | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .schema | |||
</syntaxhighlight> | |||
Show schemas of a table | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .schema PRODUCTS | |||
</syntaxhighlight> | |||
List all tables | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .tables | sqlite> .tables | ||
</syntaxhighlight> | |||
== Transaction == | |||
Start, commit, or roll back a transaction | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> BEGIN | |||
... (perform some operations here) ... | |||
sqlite> COMMIT | |||
sqlite> ROLLBACK | |||
</syntaxhighlight> | |||
== Miscellaneous == | |||
Show execution time of a query | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .timer ON | |||
</syntaxhighlight> | |||
Execute a shell command | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .system ls -l | |||
</syntaxhighlight> | |||
Quit | |||
<syntaxhighlight lang="sqlite3"> | |||
sqlite> .quit | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 11:29, 5 October 2024
List all databases and related files
sqlite> .databases
Show schemas of all tables
sqlite> .schema
Show schemas of a table
sqlite> .schema PRODUCTS
List all tables
sqlite> .tables
Transaction
Start, commit, or roll back a transaction
sqlite> BEGIN
... (perform some operations here) ...
sqlite> COMMIT
sqlite> ROLLBACK
Miscellaneous
Show execution time of a query
sqlite> .timer ON
Execute a shell command
sqlite> .system ls -l
Quit
sqlite> .quit