Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
swdev:sqlite:start [2018/04/26 21:14]
smayr [Create Database]
swdev:sqlite:start [2018/07/18 14:07] (current)
smayr [References]
Line 3: Line 3:
   * [[http://sqlite.org/download.html|SQLite database engine]]   * [[http://sqlite.org/download.html|SQLite database engine]]
   * [[http://sqlitebrowser.org|DB Browser for SQLite]]   * [[http://sqlitebrowser.org|DB Browser for SQLite]]
 +  * [[https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/|SQLite Manager (Firefox)]]
  
  
 == Create Database == == Create Database ==
-Create a database schema using a file: <code>$ sqlite3 mydatabase.db < db.schema </code>+Method 1: Create a database schema using a file:  
 +<code>$ sqlite3 mydatabase.db < db.schema </code>
  
-Or create schema manually (and then enter SQL commands at the prompt to create and populate the new tables): +Method 2: Create schema manually (and then enter SQL commands at the prompt to create and populate the new tables): 
 <code bash> <code bash>
 $ sqlite3 mydatabase.db $ sqlite3 mydatabase.db
Line 17: Line 19:
 </code> </code>
  
-Or create table interactively: 
 <code bash> <code bash>
-$ sqlite3 +$ sqlite3 mydatabase.db 
-sqlite> CREATE TABLE tbl2 +sqlite> CREATE TABLE product 
-   ...>   f1 varchar(30) primary key, +   ...>   id int(11) primary key autoincrement
-   ...>   f2 text, +   ...>   name varchar, 
-   ...>   f3 real+   ....>  description text, 
 +   ...>   price real
    ...> );    ...> );
 sqlite> sqlite>
 </code> </code>
 +
 +Method 3: Create table by importing CSV file:
 +<code bash>
 +$ sqlite3 mydatabase.db
 +sqlite> .mode csv
 +sqlite> .import C:/work/somedata.csv tab1
 +</code>
 +
 +== Alter Table ==
 +<code bash>
 +ALTER TABLE table_name
 +  ADD new_column_name column_definition;
 +</code>
 +
 +== SQLite Client ==
 +  * [[swdev:sqlite:Custom client in Csharp|Custom client in C#]]
  
 == References == == References ==
   * CLI: [[http://sqlite.org/cli.html]]   * CLI: [[http://sqlite.org/cli.html]]
 +  * [[https://www.techonthenet.com/sqlite|TechOnTheNet: SQLite]]
 +  * [[https://www.scriptol.com/sql/sqlite-async-await.php|SQLite async/await]]
 +  * [[https://www.geeksforgeeks.org/using-async-await-in-node-js|Node JS using async/await]]
 +  * [[https://github.com/mapbox/node-sqlite3/wiki/API|SQLite3 API for Node JS]]
 +  * [[https://github.com/mapbox/node-sqlite3/blob/master/examples/simple-chaining.js|SQLite3 Simple Chaining in Node JS]]