Hello, people
I have a problem with how to insert two commands (INSERT and UPDATE) into the same SQLite statement via the R language.
I do not know if this is impossible because of SQLite or the DBI package of R.
Here is an example of what I'm trying to do:
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
DBI::dbWriteTable(con, "cars_a", head(cars, 3))
DBI::dbWriteTable(con, "cars_b", head(cars, 3))
DBI::dbExecute(con,
"INSERT INTO cars_a
VALUES (10, 10 );
UPDATE cars_b
SET dist = 400
WHERE speed = 7;"
DBI::dbReadTable(con, "cars_a")
DBI::dbReadTable(con, "cars_b")
NOTE: Although the tables are named "cars_a" and "cars_b" interpret them as related. In my case, since I am working with a Web Scraping, INSERT is meant to aggregate data into the table with the scraped data, and UPDATE updates the request table.
After trying several forms, I was only able to execute the first SQL statement. As pictured below: