SQLite3

In this chapter, we are going to learn about SQLite3. SQLite3 is a file format for storing data in the same mindset of a relational database such as Oracle, MySQL, MariaDB, and Postgres. Well, I suppose that you could use SQLite3 as a traditional database engine, but it's really not made for that. SQLite3 allows us to open up a file, work with the data in that file using SQL statements, and then close that file. One file can contain one database, and a database can store multiple tables of information. Contrast this with the CSV file format that we used in the last chapter which, at best, stores a single table of information. The advantages of SQLite3 are that it doesn't require any server-side programs running in the background, there are no configurations to discuss, and the executable for working with SQLite3 is a single file. So, in my opinion, working with data in an SQLite3 file format is more versatile than working with data in a CSV file format.

In this chapter, we'll focus on how to get our data from CSV into SQLite3. Then we'll be training ourselves to think of our dataset in terms of a database using SQL statements to fetch data, which requires an understanding of SELECT queries. We do need to craft some code for translating the output from our SELECT queries into Haskell, and we'll demonstrate how to use our data summary functions from Chapter 1SQLite3, with our database.

In this chapter, we will cover the following topics:

  • Importing a CSV file into an SQLite 3 table
  • Understanding the data types of SQLite3 and running SELECT queries
  • Creating slices of data within SQLite3 and Haskell
  • Computing descriptive statistics using our SQLite3 dataset and our module

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset