## Import library
library(RSQLite)
## Connect to an existing database
Customers <- dbConnect(SQLite(), dbname = 'Customers.sqlite')
## Create and connect to a "virtual" in-memory database
Food <- dbConnect(SQLite())
## List all the tables currently in the database
dbListTables(Customers)
## Import CSV into SQLite database
'''
Currently, it seems that commas inside of a quoted string (like “Smith, John”) is still being recognized as a comma delimiter, so directly importing data from a CSV into a SQLite database is quite buggy.
'''
Suppliers <- read.csv("./Suppliers.csv") # Import CSV into R dataframe
dbWriteTable(Customers, "suppliers", Suppliers) # Write data to a table in the Customers database
## Make a query in a SQL chunk
```{sql connection=Customers}
SELECT CustomerID, CustomerName, City
FROM customers
WHERE Country = "Germany";
```