This lesson is in the early stages of development (Alpha version)

Data Management with SQL for Social Scientists *alpha*

This is an alpha lesson to teach Data Management with SQL for Social Scientists, We welcome and criticism, or error; and will take your feedback into account to improve both the presentation and the content.

This lesson is not currently under active maintenance. You are welcome to teach the lesson and contribute changes to the content, but you may have to wait longer than usual for any contributions to be processed. If you are interested in volunteering as a Maintainer on this lesson, please contact The Carpentries Curriculum Team or open an issue in this repository.

Databases are useful for both storing and using data effectively. Using a relational database serves several purposes.

This lesson will teach you what relational databases are, how you can load data into them and how you can query databases to extract just the information that you need.


We expect you to have learn a bit about the SAFI dataset in the spreadsheet and OpenRefine session. It is not necessary, but will greatly improve your ability to understand the power of SQL and when to use it versus another tool.


Setup Download files required for the lesson
00:00 1. What is a relational database? What is a relational database?
What is a table?
What is a data type?
Why do tables have key columns?
What different types of keys are there?
How does the database represent missing data?
00:15 2. Using DB Browser for SQLite What does the DB Browser for SQLite allow me to do?
00:25 3. The Select Statement What is SQL?
How can I return specific columns from a table?
How can I return specific rows from a table?
00:50 4. Missing Data How can I deal with missing data?
01:00 5. Creating New Columns How can I add new columns with derived values in the query results?
How can I give a column a new name?
How do I use built-in functions to create new values?
How can I create binned results?
01:30 6. Aggregations How can I summarise the data in my tables
01:50 7. Creating tables and views What is the difference between a table and a view?
How can I create a table using the DB Browser for SQLite?
How can I create a table or view in DB Browser for SQLite using SQL code?
How can I add records of data to a table?
02:20 8. The SQLite command line How can I save my code in a file and run it again?
02:45 9. Joins What is meant by joining tables?
Why would I want to join tables?
What different types of joins are there?
How do Joins help you discover missing data or gaps in the data
03:15 10. Using database tables in other environments How do I save my query results for use by other programs or applications?
What are and how do I use ODBC applications?
How can I access an SQLite database table from other programming environments?
03:30 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.