.\" Text automatically generated by txt2man .TH mdb-sql 1 "03 February 2024" "MDBTools 1.0.0" "Executable programs or shell commands" .SH NAME \fBmdb-sql \fP- SQL interface to MDB Tools \fB .SH SYNOPSIS .nf .fam C \fBmdb-sql\fP [\fB-HFp\fP] [\fB-d\fP \fIchar\fP] [\fB-i\fP \fIfile\fP] [\fB-o\fP \fIfile\fP] [\fIdatabase\fP] \fBmdb-sql\fP \fB-h\fP|\fB--help\fP \fBmdb-sql\fP \fB--version\fP .fam T .fi .fam T .fi .SH DESCRIPTION \fBmdb-sql\fP is a utility program distributed with MDB Tools. .PP \fBmdb-sql\fP allows querying of an MDB \fIdatabase\fP using a limited SQL subset language. .SH OPTIONS .TP .B \fB-H\fP, \fB--no-header\fP Suppress header row. .TP .B \fB-F\fP, \fB--no-footer\fP Suppress footer row. .TP .B \fB-p\fP, \fB--no-pretty-print\fP Turn off pretty printing. By default results are printed in an ascii table format which looks nice but is not conducive to manipulating the output with unix tools. This option prints output plainly in a tab separated format. .TP .B \fB-d\fP, \fB--delimiter\fP \fIchar\fP Specify an alternative column delimiter. If no delimiter is specified, columns will be delimited by a tab character if pretty printing (\fB-p\fP) is turned off. If pretty printing is enabled this option is meaningless. .TP .B \fB-i\fP, \fB--input\fP \fIfile\fP Specify an input \fIfile\fP. This option allows an input \fIfile\fP containing the SQL to be passed to \fBmdb-sql\fP. See Notes. .TP .B \fB-o\fP, \fB--output\fP \fIfile\fP Specify an output \fIfile\fP. This option allows the name of an output \fIfile\fP to be used instead of stdout. .TP .B \fB--version\fP Print the mdbtools version and exit. .SH COMMANDS \fBmdb-sql\fP in interactive mode takes some special commands. .TP .B connect to \fIdatabase\fP If no \fIdatabase\fP was specified on the command line this command is necessary before any querys are issued. It also allows the switching of databases once in the tool. .TP .B disconnect Will disconnect from the current \fIdatabase\fP. .TP .B go Each batch is sent to the parser using the 'go' command. .TP .B reset A batch can be cleared using the 'reset' command. .TP .B list tables The list tables command will display a list of available tables in this \fIdatabase\fP, similar to the mdb-tables utility on the command line. .TP .B describe table Will display the column information for the specified table. .TP .B quit Will exit the tool. .SH SQL LANGUAGE The currently implemented SQL subset is quite small, supporting only single table queries, no aggregates, and limited support for WHERE clauses. Here is a brief synopsis of the supported language. .TP .B select: SELECT [* | ] FROM
WHERE .TP .B top clause: TOP [ PERCENT ] .TP .B column list: [, ] .PP where clause: [AND ] .PP limit clause: LIMIT .TP .B operator: =, =>, =<, <>, like, ilike, <, > .TP .B literal: integers, floating point numbers, or string literal in single quotes .SH NOTES When passing a \fIfile\fP (\fB-i\fP) or piping output to \fBmdb-sql\fP the final 'go' is optional. This allow constructs like .PP echo "Select * from Table1" | \fBmdb-sql\fP mydb.mdb .PP to work correctly. .PP The \fB-i\fP command can be passed the string 'stdin' to test entering text as if using a pipe. .PP 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. .PP The 'ilike' operator is similar, but performs a case-insensitive pattern match. .SH ENVIRONMENT .TP .B LC_COLLATE Defines the locale for string-comparison operations. See \fBlocale\fP(1). .TP .B MDB_JET3_CHARSET Defines the charset of the input JET3 (access 97) \fIfile\fP. Default is CP1252. See \fBiconv\fP(1). .TP .B MDBICONV Defines the output charset. Default is UTF-8. mdbtools must have been compiled with iconv. .TP .B MDBOPTS Colon-separated list of options: .RS .IP \(bu 3 debug_like .IP \(bu 3 debug_write .IP \(bu 3 debug_usage .IP \(bu 3 debug_ole .IP \(bu 3 debug_row .IP \(bu 3 debug_props .IP \(bu 3 debug_all is a shortcut for all debug_* options .IP \(bu 3 no_memo (deprecated; has no effect) .IP \(bu 3 use_index (experimental; requires libmswstr) .SH HISTORY \fBmdb-sql\fP first appeared in MDB Tools 0.3. .SH SEE ALSO \fBmdb-array\fP(1) \fBmdb-count\fP(1) \fBmdb-export\fP(1) \fBmdb-header\fP(1) \fBmdb-hexdump\fP(1) \fBmdb-import\fP(1) \fBmdb-json\fP(1) \fBmdb-parsecsv\fP(1) \fBmdb-prop\fP(1) \fBmdb-queries\fP(1) \fBmdb-schema\fP(1) \fBmdb-tables\fP(1) \fBmdb-ver\fP(1) \fBisql\fP(1) .SH AUTHORS The \fBmdb-sql\fP utility was written by Brian Bruns. .SH BUGS The supported SQL syntax is a very limited subset and deficient in several ways.