Node/SQLite new db.sqlite for dummies

I have a question reg opening a database.
if we created a new db.sqlite, it must be empty. Where does the TemperatureData table come from?

The table is already persisted/stored in the database-file db.sqlite and has data in it at this point. The line below creates a new Database object in your JS-program by opening the file db.sqlite. The new operator is a JS-operator which gives you an instance of the database object to work with. The new operator sounds a little misleading here but it just refers to a new object in your program and not a new database file.

const db = new sqlite.Database('./db.sqlite');
1 Like