Node and SQLite tutorial

SQLite is a self-contained database engine which require no server to run (for MySQL,Oracle we require Database Server). SQLite is most popular in developing mobile apps and it is consider as most widely deployed database engine in the world.

Install the project by typing “npm install” in terminal or command prompt. It will install all dependencies and make your project ready to work.

SQLite is transaction database engine, it means you can run DDL and DML queries of SQL. DDL queries deal with creation of database, tables, view etc where as DML queries are responsible for CRUD operation (insert,delete,update) etc. Here is a code to create SQLite database and performing SQL operations.

To run and analyse the code, type node filename.js (in my case app.js) and see whether it creates “mydb.sql” file in your folder or not. This code will create table in database and add some numbers and displays it in console.

This is tutorial is for beginners. In further series i will post login-signup system and other useful tutorials about Node.js and SQLite.

SQL Queries using NodeJS:

To perform SELECT query you should use .all function and for other operations such as DELETE, UPDATE, INSERT you should use .run function. Here have a look to simple code.

Thank you for your responses.
Finally, I can install and successfully run sqlite3 v.2.2.3 with node.js v10.36. All this happens on an Intel Galileo running 32bit Windows (a tailored version of the os for this specific board). That means a lot of missing dependencies.
Again, thank you for your help 🙂

npm ERR! package.json ENOENT: no such file or directory, open ‘C:UsersBiniampackage.json’
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can’t find a package.json file in your current directory.

npm ERR! Please include the following file with any support request:
npm ERR! C:UsersBiniamnpm-debug.log