![]() ![]() You can see the fullschema of the tables when you enter: sqlite>. It returns the newly created table named ‘dhtreadings’. Sqlite> CREATE TABLE dhtreadings(id INTEGER PRIMARY KEY AUTOINCREMENT, temperature NUMERIC, humidity NUMERIC, currentdate DATE, currentime TIME, device TEXT) Let’s start by creating a table: sqlite> BEGIN I’m going to start by creating a simple table with 6 columns that could be used for temperature and humidity logging application in different parts of a home. Most people prefer to use capitalized letters, because it increases readability. It’s common for SQL commands to be capitalized, but this isn’t strictly necessary. SQL statements must end with a semicolon ( ). SQL works with different database solutions such as SQLite, MySQL and others. It can be used to create tables, insert, update, delete and search for data. Structured Query Language (SQL) is a language that’s used for interacting with databases. The shell also supports SQL commands which you’re going to try in the next section. Note: you can use the up arrow to scroll through previous commands. help‘ command you can be quickly reminded of all the supported commands and their respective usage. Commands that start with a ‘.’ are used to control the shell. The shell supports two types of commands. After typing the preceding command, a prompt appears where you can enter commands. Use this next command to invoke the shell and create a database: :~ $ sqlite3 sensordata.db You’ll have to type Y and press Enter to confirm the installation.Īfter the installation is completed, the SQLite libraries are supplied with an SQLite shell. You can install SQLite on a Raspberry Pi using this command: :~ $ sudo apt-get install sqlite3 It’s available on UNIX (Linux, Mac OS-X, Android, iOS) and Windows (Win32, WinCE, WinRT)ĭatabases are used to store information in a way that can be accessed quickly and easily. In this post you’re going to build a data logging application with a Raspberry Pi that stores temperature and humidity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |