mdb-sql is a utility program distributed with MDB Tools.
It allows querying of an MDB database using a limited SQL subset language.
The supported SQL is intentionally small: single-table queries, no aggregates,
and limited WHERE support.
mdb_sql(
path,
statement = NULL,
no_header = FALSE,
no_footer = FALSE,
no_pretty_print = FALSE,
delimiter = "\t",
input = NULL,
output = NULL,
as_text = FALSE
)Path to .mdb/.accdb file.
SQL statement text.
Logical, equivalent to -H/--no-header (for text mode).
Logical, equivalent to -F/--no-footer (for text mode).
Logical, equivalent to -p/--no-pretty-print.
Delimiter equivalent to -d/--delimiter in plain text mode.
Input file equivalent to -i/--input.
Output file equivalent to -o/--output.
Logical; when TRUE, returns CLI-like text output.
data.frame by default, or character scalar in text mode.
In addition to single statements, this wrapper accepts input files similar
to mdb-sql -i file, strips go batch terminators, and executes the script
one statement at a time.
db <- mdbr:::.mdb_example_nwind_path()
if (nzchar(db)) {
mdb_sql(db, "SELECT [ProductID], [ProductName] FROM [Products] LIMIT 3;")
}