Ex 13 -init code.sql


I’m confused with the whole concept of using “-init” and what it does.
In the ex13 things starts from making sure that I have code.sql file created with all *.sqls stored there.
I don’t get it at all, i tried to go back to earlier excercises but I still don’t understand what exactly does “-init” do, why we use it? I’ve tried to do all previous excercises without it and things were working just fine.
So, why when doing something like this:
./sqlite3 ex3.db
i have to add
-init ex3.sql
what does it help me with?
what would happen if I would do ./sqlite3 ex3.db -init ex4.sql - i don’t see any purpose of that

Couldn’t find any documentation to explain it in simple words, please help me to understand it couse it’s really frustrating.


All the -init ex3.sql does is run that sql file to “initialize” your database. I tell people on Windows to do that because PowerShell is limited. You don’t have to run that every time you start sqlite3, just the first time when you create your database.