# Sqlite database has some Nulls how to create a line graph?

**URL:** <https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053>\
**Category:** General\
**Created:** [10 October 2020 14:49 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053 "2020-10-10T14:49:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 October 2020 15:18 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053/2 "2020-10-10T15:18:23Z")

</div>

Why do you have your database setup that way, wouldn't it be better (and easier) to have column labeled 'device' or 'uint' and put the device name there with it's readings. So you would end up with  
`ID, Device, Unix_Time, Day, Date, Time, Humidity, Temperature`  
Then you could query by device and adding another device would be easy as using the new name. Also, why store the Day, Date and Time when you have the Unix\_time? So your table could be  
`ID, Device, Unix_Time, Humidity, Temperature`  
and you could convert the Unix\_time to what ever date format you want (note: as of NR v1.1.0 the change node supports the moment.js library. Here is a thread explaining how to use it [Formatting times & dates with moment.js examples](https://discourse.nodered.org/t/formatting-times-dates-with-moment-js-examples/29553)

---

_[View the full topic](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053)._
