Jun 14, 2024
CREATE Query: Creates tables
CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)
id
is an INTEGER, PRIMARY KEY, AUTOINCREMENT.name
is a TEXT field for user names.INSERT Query: Inserts data into tables
INSERT INTO users (name) VALUES ('Tommy')
SELECT Query: Reads data from tables
SELECT * FROM users WHERE name = 'Tommy'
UPDATE Query: Updates existing data in tables
UPDATE users SET name = 'Tommy M' WHERE name = 'Tommy'
TableViewController
for the main screen showing notes.ViewController
for the note detail view.struct Note { var id: Int, var contents: String }
FileManager
to get the database URL.sqlite3_open
to connect.sqlite3_exec
to execute SQL commands.prepare(for:sender:)
to pass data between view controllers.viewWillAppear
to refresh data when returning to the main view.