Consider script.sql
below. I (1): create a table; (2) manually insert values into the table; and (3) query from the created table.
script.sql
-- !preview conn=DBI::dbConnect(RSQLite::SQLite())
CREATE TEMPORARY TABLE my_table (
id INTEGER PRIMARY KEY,
name TEXT
);
INSERT INTO my_table (id, name)
VALUES (1, 'John'),
(2, 'Jane'),
(3, 'Alice');
SELECT * FROM my_table;
When I run script.sql
in RStudio, however, I don't get an error but the message: 'No data available in table'.
Is there a syntactical reason this doesn't work? Or is it the RStudio context?