SQLite

SQLite

https://simpholders.com/ –>可以在本機端裝DB
http://sqlitebrowser.org/–>可以用SQlite的GUI
https://github.com/ccgus/fmdb–>Xcode 的freamWork


//建立資料表location

create table location(
longitude double NOT NULL,
latitude double NOt NULL

)


//宣告成為PRIMARY KEY

id INTEGER NOT NILL PRIMARY KEY,


//快速索引longitude欄位的資料

create index locationindex on location(longitude);

create table location(
longitude double NOT NULL,
latitude double NOt NULL
PRIMARY KEY(longitude,latitude));
)


insert

insert into location(
longitude,
latitude
)values(
5.4,
5.533
);


update

update location
set longitude = 5.9654 , latitude = 5.8645


delete
整列刪掉

<br>
delete from location
where longitude = 5.9654;


query
select * from location;
* =>every column
select
longitude
from location;


select
longitude,latitude
from location
order by longitude asc;


小於5.5

select
longitude,latitude
from location
where longitude <5.5
order by longitude asc;



select id , name, url
from champions
where id = 1 and name = ‘Annie’
order by name


// array

select id , name, url
from champions
where id = ? and name =?
order by name


// Hasher Dictionary

select id , name, url
from champions
where id = :id and name =:name
order by name

Comments

Popular posts from this blog

MEGA 暫存檔案刪除

IOS GCD多執行緒

利用CMD指令強制刪除