MySQL & SQLite
MySQL
Usage
$ mysql -u root
進入
Database
show databases;
create database [database];
use [database];
Table
show tables;
create table [table] ([colname] [type]);
create table todos (id integer PRIMARY KEY AUTO_INCREMENT , description text, completed boolean NOT NULL);
describe [table];
回傳資料表結構drop table [table];
Data
insert into todos (description, completed) values('hihi', false);
select * from todos;
SQLite
OS: OS X
Download
https://sqlite.org/download.html
下載Precompiled Binaries for Mac OS X (x86)
解壓把sqlite3放入 /usr/local/bin
Usage
$ sqlite
進入
.help
.databases 列出所有資料庫
.open test.db 建立資料庫(通常放在 ~/ )
.schema [table]