Reader small image

You're reading from  Full Stack Web Development with Raspberry Pi 3

Product typeBook
Published inAug 2017
Reading LevelExpert
PublisherPackt
ISBN-139781788295895
Edition1st Edition
Languages
Right arrow
Author (1)
Soham Kamani
Soham Kamani
author image
Soham Kamani

Soham Kamani is a full-stack developer who has extensive experience in the JavaScript ecosystem. He works as a consultant, developing end-to-end web-based solutions for clients around the world. He is an open source enthusiast and an avid blogger. He has worked on many frameworks and technologies such as React, Angular, Node, Express, Sails, SQLite, Postgres, and MySQL, and he has worked on many projects in the IoT space using Arduino and Raspberry Pi systems.
Read more about Soham Kamani

Right arrow

Creating the temperature and humidity tables

For our application, we will be creating two tables, one each for our temperature and humidity readings. The structure will be similar for both of them:

  • The createdAt column to store the date and time of creation
  • The value column to store the actual value read by the sensor

When creating the table, it's useful to know SQLites datatypes. This will not be a hard task since there are only five:

  • TEXT
  • NUMERIC
  • INTEGER
  • REAL
  • BLOB
In most other relational databases, there is a data type for datetime, which we would have used for our createdAt column. In the case of SQLite, the datetime is represented either as a string in the ISO format (YYYY-MM-DD HH:MM:SS), or as an integer in Unix time (the time elapsed since 1970-01-01 00:00:00 UTC).

From this, we decide the types of these:

  • createdAt as TEXT (ISO formatted datetime)
  • value as REAL...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Raspberry Pi 3
Published in: Aug 2017Publisher: PacktISBN-13: 9781788295895

Author (1)

author image
Soham Kamani

Soham Kamani is a full-stack developer who has extensive experience in the JavaScript ecosystem. He works as a consultant, developing end-to-end web-based solutions for clients around the world. He is an open source enthusiast and an avid blogger. He has worked on many frameworks and technologies such as React, Angular, Node, Express, Sails, SQLite, Postgres, and MySQL, and he has worked on many projects in the IoT space using Arduino and Raspberry Pi systems.
Read more about Soham Kamani