Now that we have some background on SQL and relational databases, let's download a local copy of an SQLite database file, set up a connection, and load some data into a pandas DataFrame. For this example, I have provided the database file named customer_sales.db so be sure to download it from the GitHub repository beforehand.
To give you some context about this database file and support the Know Your Data(KYD) concept that we learned in Chapter 1, Fundamentalsof Data Analysis, we have three tables named tbl_customers, tbl_products, and tbl_sales. This would be a simple example of any company that has customers who purchase products that generate sales over any period of time. A visual representation of how the data is stored and joined together, which is commonly known as an ERD (short for Entity Relationship Diagram), is shown in the following diagram:
In the preceding diagram, we have a...