Databases and SQL

University of Oslo


Nov 11, 2020

9:00 - 16:00

Instructors: Kyrre T. Låberg, Dan Michael O. Heggø

Helpers: Viviane Girardin, Erik Winge

General Information

Software Carpentry aims to help researchers get their work done in less time and with less pain by teaching them basic research computing skills. This hands-on workshop will cover basic concepts and tools, including program design, version control, data management, and task automation. Participants will be encouraged to help one another and to apply what they have learned to their own research problems.

For more information on what we teach and why, please see our paper "Best Practices for Scientific Computing".

Who: The course is aimed at graduate students and other researchers. You don't need to have any previous knowledge of the tools that will be presented at the workshop.

Where: This training will take place online. The instructors will provide you with the information you will need to connect to this meeting.

When: Nov 11, 2020. Add to your Google Calendar.

Requirements: Participants must have access to a computer with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have a few specific software packages installed (listed below).

Accessibility: We are dedicated to providing a positive and accessible online learning environment for all. Please notify the instructors in advance of the workshop if you require any accommodations or if there is anything we can do to make this workshop more accessible to you.

Contact: Please email for more information.

Roles: To learn more about the roles at the workshop (who will be doing what), refer to our Workshop FAQ.

Code of Conduct

Everyone who participates in Carpentries activities is required to conform to the Code of Conduct. This document also outlines how to report an incident if needed.

Collaborative Notes

We will use this collaborative document for chatting, taking notes, and sharing URLs and bits of code.


Please be sure to complete these surveys before and after the workshop.

Pre-workshop Survey

Post-workshop Survey


09:00 1. Selecting Data How can I get data from a database?
09:20 2. Sorting and Removing Duplicates How can I sort a query’s results?
How can I remove duplicate values from a query’s results?
09:40 3. Filtering How can I select subsets of data?
10:00 4. Calculating New Values How can I calculate new values on the fly?
10:30 Morning break
10:45 5. Missing Data How do databases represent missing information?
What special handling does missing information require?
11:00 6. Aggregation How can I calculate sums, averages, and other summary values?
11:30 7. Combining Data How can I combine data from multiple tables?
12:00 Lunch break
13:00 8. Data Hygiene How should I format data in a database, and why?
13:30 9. Creating and Modifying Data How can I create, modify, and delete tables and data?
14:15 Afternoon break
14:30 10. Programming with Databases - Python or Programming with Databases - R How can I access databases from programs written in Python or R?
15:30 Wrap-up
16:00 Finish


To participate in a Software Carpentry workshop, you will need access to the software described below. In addition, you will need an up-to-date web browser.

We maintain a list of common issues that occur during installation as a reference for instructors that may be useful on the Configuration Problems and Solutions wiki page.

Install the videoconferencing client

If you haven't used Zoom before, go to the official website to download and install the Zoom client for your computer.

Set up your workspace

Like other Carpentries workshops, you will be learning by "coding along" with the Instructors. To do this, you will need to have both the window for the tool you will be learning about (a terminal, RStudio, your web browser, etc..) and the window for the Zoom video conference client open. In order to see both at once, we recommend using one of the following set up options:

This blog post includes detailed information on how to set up your screen to follow along during the workshop.

DB Browser for SQLite

SQL is a specialized programming language used with databases. We will use the program DB Browser for SQLite to work with the SQLite flavour of SQL in our lesson.

  • Download and install DB Browser for SQLite (Standard installer for 64-bit Windows) from
  • Run the installer. On the Shortcuts page, you might want to tick the "Desktop" and/or "Program Menu" checkboxes for "DB Browser (SQLite)". Otherwise, just go with the defaults.

Download the example database

In the workshop, we will work with an example database that can be downloaded here: survey.db