SQLite tutorial 1

Jameskrauser Lee
3 min readOct 24, 2017

--

1.What is SQLite
2.SQLite vs Core Data vs Realm
3.SQLite Demo in Mac OS

start
1.What is SQLite
SQLite3 is an Opensource , apple use it in Xcode
a. One file is the database, you don’t need to create database like oracle
b. it is lightweight database
c.SQLite can support ios , android , windows

2.SQLite vs Core Data vs Realm [1][2]

Above pic.memory consume
Above pic. hard disc consume
Above Pic. Speed access DB

SQLite:
advantage:
- support iOS , android , windows , ubuntu platform
- memory consumer more less

Core data:
advantage:
- evolution from SQLite , you don’t need to know SQL command.
- access speed more fast than SQLite
- iOS MacOS platform only
- support iCloud

RealM:[3]
Realm is a opensource mobile database.
Realm is a replacement for SQLite & core Data.
it can save you thounsand of line of code & week of work.
support Objective-C , Swift and Java.
platform support: iOS , Mac , Android

3.SQLite Demo in Mac OS
download SQLite Database browser download

click Create Database and save to booklist, we will get booklist.db file
click Create Table add Column

util now , we finish Database Structure.
click Browse Data to add record

we can execute SQL

Add SQLite in your Objective C command line project
PS. my xcode version is 9

click +
input SQLite , select libsqlite3.0.tbd
Added success

execute result ,show the record in SQLite DB

Data From
[1] http://www.drdobbs.com/mobile/ios-data-storage-core-data-vs-sqlite/240168843
[2]http://www.jianshu.com/p/792551a9fcbc
[3]http://blog.devzeng.com/blog/simple-usage-of-realm-in-ios.html
[4]http://blog.csdn.net/enuola/article/details/7796617

example source code
https://github.com/jameskrauser/objectiveC_tutorial
SQLite_1.m and SQLiteBooks.db

--

--

Jameskrauser Lee
Jameskrauser Lee

Written by Jameskrauser Lee

For the last few years. i was involved mostly in the development of Automatic Fare collection system for the Chennai Metro. Familiar with C++ and iOS.