How to Convert SQL into R Data Frame? Part 1
In this series of articles, we will study how to convert SQL statements into R data frame syntax. We are using Kaggle Notebook to access the SQLite database file stored in Cloud Drive and to run the R scripts.
Underlying data/ database
We upload the SQLite DB file named with “sample.db” under into Kaggle notebook (/kaggle/input/sqlite/sample.db). The data we are using is SQLite Sample Database Chinook.
library(RSQLite)
conn <- dbConnect(RSQLite::SQLite(), "/kaggle/input/sqlite/sample.db")
df_albums <- dbGetQuery(conn,'select * from albums')
df_tracks <- dbGetQuery(conn,'select * from tracks')
df_invoices <- dbGetQuery(conn,'select * from invoices')
df_invoicesitem <- dbGetQuery(conn,'select * from invoice_items')
Keep reading with a 7-day free trial
Subscribe to Informula to keep reading this post and get 7 days of free access to the full post archives.