Using SQLite
Read the whole post on https://thriveread.com/node-red-node-sqlite/
[{"id":"a6a951a410422863","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"13e3de6e547db537","type":"sqlite","z":"a6a951a410422863","mydb":"9d201569cf5d2249","sqlquery":"msg.topic","sql":"","name":"SQLITE","x":560,"y":120,"wires":[["4949d6746f21e955"]]},{"id":"2b38df9e7c82dab5","type":"function","z":"a6a951a410422863","name":"function 1","func":"msg.topic = \"INSERT INTO sensors (id, name, value, UNIT, timestamp) VALUES (null, $val1, $val2, $val3, datetime(\\\"now\\\"));\"\nmsg.payload = ['Sensor 1', 23, 'Temp']\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":120,"wires":[["13e3de6e547db537"]]},{"id":"fe2d45b4ef7d8d9d","type":"inject","z":"a6a951a410422863","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":120,"wires":[["2b38df9e7c82dab5"]]},{"id":"4949d6746f21e955","type":"debug","z":"a6a951a410422863","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":120,"wires":[]},{"id":"fceaba3ea471462e","type":"sqlite","z":"a6a951a410422863","mydb":"9d201569cf5d2249","sqlquery":"prepared","sql":"INSERT INTO sensors (name, value, UNIT, timestamp) VALUES ($val1, $val2, $val3, datetime(\"now\"));","name":"SQLITE","x":560,"y":260,"wires":[["e31e4198bcb316f7"]]},{"id":"ac2b01220fac3f5e","type":"function","z":"a6a951a410422863","name":"function 2","func":"msg.params = { $val1:'Sensor 1', $val2: 47 , $val3: 'HUMID'}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":260,"wires":[["fceaba3ea471462e"]]},{"id":"d5743fa67bd8fdbb","type":"inject","z":"a6a951a410422863","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":260,"wires":[["ac2b01220fac3f5e"]]},{"id":"e31e4198bcb316f7","type":"debug","z":"a6a951a410422863","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":260,"wires":[]},{"id":"fa45f6c4c6b1d12d","type":"sqlite","z":"a6a951a410422863","mydb":"9d201569cf5d2249","sqlquery":"batch","sql":"INSERT INTO sensors (name, value, UNIT, timestamp) VALUES ($val1, $val2, $val3, datetime(\"now\"));","name":"SQLITE","x":560,"y":380,"wires":[["ce0e0dde38ec2ee3"]]},{"id":"b672daf81a59391b","type":"function","z":"a6a951a410422863","name":"function 3","func":"msg.topic = \"INSERT INTO sensors (name, value, UNIT, timestamp) VALUES ('SENSOR 3', 23, 'VOLT',datetime(\\\"now\\\")); INSERT INTO sensors (name, value, UNIT, timestamp) VALUES ('SENSOR 4 ', 124, 'KM',datetime(\\\"now\\\"));\"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":380,"wires":[["fa45f6c4c6b1d12d"]]},{"id":"984069e5bc5fa442","type":"inject","z":"a6a951a410422863","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":380,"wires":[["b672daf81a59391b"]]},{"id":"ce0e0dde38ec2ee3","type":"debug","z":"a6a951a410422863","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":380,"wires":[]},{"id":"df4820f3aadf0ac5","type":"inject","z":"a6a951a410422863","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":500,"wires":[["5a73549594a621fb"]]},{"id":"5a73549594a621fb","type":"sqlite","z":"a6a951a410422863","mydb":"9d201569cf5d2249","sqlquery":"fixed","sql":"SELECT * FROM sensors ORDER BY timestamp DESC LIMIT 100;","name":"SQLITE","x":480,"y":500,"wires":[["2e2d96a99431b500"]]},{"id":"2e2d96a99431b500","type":"debug","z":"a6a951a410422863","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":500,"wires":[]},{"id":"9d201569cf5d2249","type":"sqlitedb","db":"D:\\node-red-node-sqlite\\sensor.db","mode":"RWC"}]