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, --delimiter char β€” 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, --input file β€” specify an input file. this lets you pass a file containing the SQL to mdb-sql. check the NOTES section, iykyk. 🫢
  • -o, --output file β€” 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 the go command. no go, no parse, periodt. 🎯
  • reset β€” a batch can be cleared using the reset command. ctrl+z but make it SQL. 🧹
  • list tables β€” displays a list of available tables in this database, similar to the mdb-tables utility 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. see locale(1). 🌍
  • MDB_JET3_CHARSET β€” defines the charset of the input JET3 (access 97) file. default is CP1252. see iconv(1). πŸ”€
  • MDBICONV β€” defines the output charset. default is UTF-8. mdbtools must have been compiled with iconv. ⚠️
  • MDBOPTS β€” colon-separated list of options:
    • debug_like
    • debug_write
    • debug_usage
    • debug_ole
    • debug_row
    • debug_props
    • debug_all is a shortcut for all debug_* options
    • no_memo (deprecated; has no effect)
    • use_index (experimental; requires libmswstr)

⭐ 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