Want to keep learning?

This content is taken from the Raspberry Pi Foundation & National Centre for Computing Education's online course, Introduction to Databases and SQL. Join the course to learn more.

Skip to 0 minutes and 2 secondsIn this course, you're going to explore a modified database which tracks computer sales using SQL. To access and change the data in a database, you will need to use a software package known as a database management system or DBMS. I'm going to instal DB browser for SQLite, but you can also use an online DBMS, such as sqliteonline.com Click Open the Database, and open the previously downloaded computer sales file.

Skip to 0 minutes and 40 secondsAnd here you can see the different tables within our database, so we have manufacturer, model, and sales. And you can start to see what data is in those tables. We can also browse data, and when we browse the data, we can see what's inside those two tables. So, for example, manufacturer, we have the name.

Skip to 1 minute and 12 secondsSo we've got Raspberry Pi, Apple, and Commodore. In the Models table, we can see that we've got the different model names. So for example, we've got the first ever Raspberry Pi all the way down to the most recent one, Raspberry Pi 4, and we've got a couple of Pi zeros, Apples, and the Commodores ended in Amiga 500. Are you up for a challenge? Look through the data in the database and see if you can find the computer which has the least amount of RAM from a company which is still trading. Share your answers and describe how you found the data in the comments below.

Explore a database

During this course you will be exploring and modifying an example database that tracks computer sales.

Computer sales database

The computer sales database you will be using is an SQLite relational database.

SQLite databases are stored in single, self-contained files. SQLite is the most widely used database in the world, partly because it’s very simple to use and has very low hardware and software overheads. In computing, an overhead refers to the processing time required by hardware or software. Other relational databases are MySQL, PostgreSQL, Access, and SQL Server.

In this step, you will explore the structure and contents of the computer sales database and see how a database can be used to store specific information.

Browse the database

To access a database, you need to use a software package known as a database management system (DBMS). The DBMS is used to define, manipulate, retrieve, and manage data in a database. Most databases come with their own DBMS software.

You will need to use an SQLite DBMS during this course. I recommend using either:

1. Download and install DB Browser for SQLite or open SQLite Online.

2. Download the example computer_sales.db SQLite database file.

If you are using DB Browser:

3. Click Open Database and select the computer_sales.db file you downloaded.

DB Browser application with the Open Database button on the toolbar highlighted

When the database is open, you will see three tables, manufacturer, model, and sales, in the Database Structure tab.

DB Browser application showing the three tables in the computer_sales.db under the database structure tab

4. Click on the Browse Data tab and select a Table to see the contents of the database.

DB Browser application showing the contents of the manufacturer table with the Browse Data tab and manufacturer table highlighted

If you are using SQLite Online:

3. Click File, then Open DB and select the computer_sales.db file you downloaded.

sqliteonline.com with the file and open DB button on the menu highlighted

When the database is open, you will see three tables, manufacturer, model, and sales, in the Table section under SQLite.

sqliteonline.com showing the three tables in the computer_sales.db in the tables section under SQLite

4. Right-click on the name of a table and click SELECT (Show table) to see the contents of the database.

sqliteonline.com with the name of the manufacturer table and SELECT (Show table) highlighted in the menu

Challenge

By looking through the data in the database, can you find the computer that has the least amount of RAM from a company that is still trading?

In the comments section, describe how you found the data.

Share this video:

This video is from the free online course:

Introduction to Databases and SQL

Raspberry Pi Foundation