mdb-sql(1)
π mdb-sql β the SQL interface to MDB Tools π
okay bestie, gather round, because mdb-sql is literally the moment. it's a utility program that ships with MDB Tools, and what it does is let you query an MDB database using a limited SQL subset language. yes, limited. we'll get to that. stay with me. π¦
β¨ SYNOPSIS β¨
mdb-sql [-HFp] [-d char] [-i file] [-o file] [database]
mdb-sql -h|--help
mdb-sql --version
πΈ DESCRIPTION πΈ
mdb-sql is a utility program distributed with MDB Tools.
it lets you query an MDB database using a limited SQL subset language. that's the whole vibe. no cap. π
π OPTIONS π
-H,--no-headerβ suppresses the header row. bye bye header. π-F,--no-footerβ suppresses the footer row. footer? don't know her. π-p,--no-pretty-printβ turns off pretty printing. by default, results come out in an ascii table format that looks nice but is not conducive to manipulating the output with unix tools. this option prints output plainly in a tab separated format. so: pretty vs. pipeable, pick your fighter. β¨-d,--delimiterchar β specify an alternative column delimiter. if no delimiter is specified, columns get delimited by a tab character when pretty printing (-p) is turned off. and if pretty printing is enabled? this option is meaningless. literally does nothing. sorry bestie. π-i,--inputfile β specify an input file. this lets you pass a file containing the SQL tomdb-sql. check the NOTES section, iykyk. π«Ά-o,--outputfile β specify an output file. lets you name an output file instead of using stdout. π--versionβ prints the mdbtools version and exits. that's it, that's the option. β
π§ COMMANDS π§
when mdb-sql is in interactive mode, it takes some special commands. here's the whole roster:
connect to databaseβ if no database was specified on the command line, this command is necessary before any querys are issued. it also lets you switch databases once you're inside the tool. so useful, honestly. π₯disconnectβ disconnects from the current database. it's giving goodbye. πgoβ each batch is sent to the parser using thegocommand. nogo, no parse, periodt. π―resetβ a batch can be cleared using theresetcommand. ctrl+z but make it SQL. π§Ήlist tablesβ displays a list of available tables in this database, similar to themdb-tablesutility on the command line. iconic behaviour. πdescribe table<table>β displays the column information for the specified table. get to know your columns bestie. πquitβ exits the tool. the final boss of leaving. π
π SQL LANGUAGE π
the currently implemented SQL subset is quite small, bestie. it supports only single table queries, no aggregates, and limited support for WHERE clauses. and here's a brief synopsis of the supported language:
select:
SELECT <top clause> [* | <column list>] FROM <table> WHERE <where clause> <limit clause>
top clause:
TOP <integer> [ PERCENT ]
column list:
<column> [, <column list>]
where clause:<column> <operator> <literal> [AND <where clause>]limit clause:LIMIT <integer>operator:=,=>,=<,<>,like,ilike,<,>literal: integers, floating point numbers, or string literal in single quotes
π¦ NOTES π¦
when passing a file (-i) or piping output to mdb-sql, the final go is optional. this allows constructs like
echo "Select * from Table1" | mdb-sql mydb.mdb
to work correctly. slay. β¨
the -i command can be passed the string 'stdin' to test entering text as if using a pipe. cute. π
the 'like' operator performs a case-sensitive pattern match, with ANSI-style wildcards. an underscore in the pattern will match any single character, and a percent sign will match any run of characters. so _ = one char, % = the whole run. πΈ
the 'ilike' operator is similar, but performs a case-insensitive pattern match. β¨
π ENVIRONMENT π
LC_COLLATEβ defines the locale for string-comparison operations. seelocale(1). πMDB_JET3_CHARSETβ defines the charset of the input JET3 (access 97) file. default isCP1252. seeiconv(1). π€MDBICONVβ defines the output charset. default isUTF-8. mdbtools must have been compiled with iconv. β οΈMDBOPTSβ colon-separated list of options:debug_likedebug_writedebug_usagedebug_oledebug_rowdebug_propsdebug_allis a shortcut for alldebug_*optionsno_memo(deprecated; has no effect)use_index(experimental; requireslibmswstr)
β HISTORY β
mdb-sql first appeared in MDB Tools 0.3. a true original. π«
π SEE ALSO π
mdb-array(1) mdb-count(1) mdb-export(1) mdb-header(1) mdb-hexdump(1) mdb-import(1) mdb-json(1) mdb-parsecsv(1) mdb-prop(1) mdb-queries(1) mdb-schema(1) mdb-tables(1) mdb-ver(1) isql(1)
the whole friend group, fr fr. π«Ά
π AUTHORS π
the mdb-sql utility was written by Brian Bruns. king behaviour. π
π BUGS π
the supported SQL syntax is a very limited subset and deficient in several ways. yeah. we said it. not me being honest about it. π
bestie this page is from MDBTools 1.0.1, dated 13 July 2026, and it's filed under mdb-sql(1) in the Executable programs or shell commands section of the manual. mwah. πβ¨
π¦ where this page comes from
- fedora 43: mdbtools 1.0.1-1.fc43 Β· GPL-2.0-or-later
- fedora 44: mdbtools 1.0.1-1.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms