1mdb-sql(1) Executable programs or shell commands mdb-sql(1)
2
3
4
6 mdb-sql - SQL interface to MDB Tools
7
9 mdb-sql [-HFp] [-d char] [-i file] [-o file] [database]
10 mdb-sql -h|--help
11 mdb-sql --version
12
13
15 mdb-sql is a utility program distributed with MDB Tools.
16
17 mdb-sql allows querying of an MDB database using a limited SQL subset
18 language.
19
21 -H, --no-header
22 Suppress header row.
23
24 -F, --no-footer
25 Suppress footer row.
26
27 -p, --no-pretty-print
28 Turn off pretty printing. By default results are printed in an
29 ascii table format which looks nice but is not conducive to ma‐
30 nipulating the output with unix tools. This option prints output
31 plainly in a tab separated format.
32
33 -d, --delimiter char
34 Specify an alternative column delimiter. If no delimiter is
35 specified, columns will be delimited by a tab character if
36 pretty printing (-p) is turned off. If pretty printing is en‐
37 abled this option is meaningless.
38
39 -i, --input file
40 Specify an input file. This option allows an input file contain‐
41 ing the SQL to be passed to mdb-sql. See Notes.
42
43 -o, --output file
44 Specify an output file. This option allows the name of an output
45 file to be used instead of stdout.
46
47 --version
48 Print the mdbtools version and exit.
49
51 mdb-sql in interactive mode takes some special commands.
52
53 connect to database
54 If no database was specified on the command line this command is
55 necessary before any querys are issued. It also allows the
56 switching of databases once in the tool.
57
58 disconnect
59 Will disconnect from the current database.
60
61 go Each batch is sent to the parser using the 'go' command.
62
63 reset A batch can be cleared using the 'reset' command.
64
65 list tables
66 The list tables command will display a list of available tables
67 in this database, similar to the mdb-tables utility on the com‐
68 mand line.
69
70 describe table <table>
71 Will display the column information for the specified table.
72
73 quit Will exit the tool.
74
76 The currently implemented SQL subset is quite small, supporting only
77 single table queries, no aggregates, and limited support for WHERE
78 clauses. Here is a brief synopsis of the supported language.
79
80 select:
81 SELECT <top clause> [* | <column list>] FROM <table> WHERE
82 <where clause> <limit clause>
83
84 top clause:
85 TOP <integer> [ PERCENT ]
86
87 column list:
88 <column> [, <column list>]
89
90 where clause: <column> <operator> <literal> [AND <where clause>]
91
92 limit clause: LIMIT <integer>
93
94 operator:
95 =, =>, =<, <>, like, ilike, <, >
96
97 literal:
98 integers, floating point numbers, or string literal in single
99 quotes
100
102 When passing a file (-i) or piping output to mdb-sql the final 'go' is
103 optional. This allow constructs like
104
105 echo "Select * from Table1" | mdb-sql mydb.mdb
106
107 to work correctly.
108
109 The -i command can be passed the string 'stdin' to test entering text
110 as if using a pipe.
111
112 The 'like' operator performs a case-sensitive pattern match, with ANSI-
113 style wildcards. An underscore in the pattern will match any single
114 character, and a percent sign will match any run of characters.
115
116 The 'ilike' operator is similar, but performs a case-insensitive pat‐
117 tern match.
118
120 LC_COLLATE
121 Defines the locale for string-comparison operations. See lo‐
122 cale(1).
123
124 MDB_JET3_CHARSET
125 Defines the charset of the input JET3 (access 97) file. Default
126 is CP1252. See iconv(1).
127
128 MDBICONV
129 Defines the output charset. Default is UTF-8. mdbtools must have
130 been compiled with iconv.
131
132 MDBOPTS
133 Colon-separated list of options:
134
135 • debug_like
136
137 • debug_write
138
139 • debug_usage
140
141 • debug_ole
142
143 • debug_row
144
145 • debug_props
146
147 • debug_all is a shortcut for all debug_* options
148
149 • no_memo (deprecated; has no effect)
150
151 • use_index (experimental; requires libmswstr)
152
154 mdb-sql first appeared in MDB Tools 0.3.
155
157 mdb-array(1) mdb-count(1) mdb-export(1) mdb-header(1) mdb-hexdump(1)
158 mdb-import(1) mdb-json(1) mdb-parsecsv(1) mdb-prop(1) mdb-queries(1)
159 mdb-schema(1) mdb-tables(1) mdb-ver(1) isql(1)
160
162 The mdb-sql utility was written by Brian Bruns.
163
165 The supported SQL syntax is a very limited subset and deficient in sev‐
166 eral ways.
167
168
169
170MDBTools 1.0.0 20 July 2023 mdb-sql(1)