Querying SQLite from R

In our Querying SQLite from R mission, you’ll learn how to query a SQLite database using the DBI and RSQLite packages.

Being able to write SQL queries using R can be quite beneficial. Otherwise, you would find yourself writing code in R, exporting data from R, importing that in a separate program you have that can query data, saving that data, and importing it back into R. That would be, needless to say, a cumbersome process!

In this mission, you will learn how to avoid that process by writing queries for a SQLite database from within R using the DBI and RSQLite packages. As you progress through the mission, you will get familiar with connecting to SQLite databases and build experience with the SQL query workflow.

Throughout this mission, you’ll also continue your analysis of the 2010-2012 college grade data to give you practice using SQL to solve real-world data science problems.


  • How to run SQL queries using RSQLite in R.

Lesson Outline

  1. Overview
  2. Introduction to the Data
  3. Connecting to the Database
  4. Running Queries With Our Connection
  5. Limitations of dbGetQuery()
  6. Cleaning Up After Ourselves
  7. Using the Whole Workflow
  8. Wrapping Up The Connection
  9. Next Steps
  10. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.