我想使用R按行名订购SQL数据库。我能够获取订购的结果:
library(RSQLite)
library(DBI)
con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")
dbWriteTable(con, "cars", mtcars, temporary = TRUE, overwrite = FALSE, row.names = FALSE)
dbReadTable(con, "cars")
res <- dbSendQuery(con, 'SELECT * FROM cars ORDER BY rowname ASC')
dbFetch(res)
但是我想订购SQL数据库本身。如果我尝试以下代码,则不会发生任何事情:
dbExecute(con, 'SELECT * FROM cars ORDER BY rowname ASC')
dbReadTable(con, "cars")