I have been studying a YouTube video from Andrew Couch about RSQLite, DBI, and dbplyr packages.
CodePudding user response:
The table name is sq_mtcars
- i.e. the select
statement is for the particular table
and the connection is already established with the database
DBI::dbGetQuery(con, '
SELECT sql_mtcars.mpg
FROM sql_mtcars
')
-output
mpg
1 21.0
2 21.0
3 22.8
4 21.4
5 18.7
6 18.1
7 14.3
8 24.4
9 22.8
10 19.2
11 17.8
...
If there are doubts, list the tables with
dbListTables(con)
[1] "sql_mtcars" "sqlite_stat1" "sqlite_stat4"