Linux
sudo apt-get update
sudo apt-get upgrade
ubuntu@ubiquityrobot:~$ sqlite3
SQLite version 3.11.0 2016-02-15 17:29:24
Enter “.help” for usage hints.
Connected to a transient in-memory database.
Use “.open FILENAME” to reopen on a persistent database.
sqlite>
Windows
Commands
Table作成
CREATE TABLE <Table Name> (<Field 1 Name> <Data Type>, …….. <Field n Name> <Data Type>);
sqlite> create table sensors (sensor_ID integer, sensor_Name text);
Insert Data
INSERT INTO <Table Name> (<Field 1>, <Field 2>, ……… <Field n>) VALUES (<Value 1>, <Value 2>, ………. <Value n>);
sqlite> insert into sensors (sensor_ID, sensor_Name) values (1,”Light Sensor”);
sqlite> insert into sensors (sensor_ID, sensor_Name) values (2,”Temperature”);
Get Data From Table
SELECT * FROM <Table Name>;
sqlite> select * from sensors;
1|Light Sensor
2|Temperature
sqlite>
Delete Table
DROP TABLE IF EXISTS <Table Name>;
sqlite> drop table if exists sensors;
sqlite>
Exit
sqlite>
sqlite> .exit
pi@raspberrypi:~ $