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 delimiter] [-i file] [-o file] [database]
10
11
13 mdb-sql is a utility program distributed with MDB Tools.
14
15 mdb-sql allows querying of an MDB database using a limited SQL subset
16 language.
17
19 -H Supress header row.
20
21 -F Supress footer row.
22
23 -p Turn off pretty printing. By default results are printed in an
24 ascii table format which looks nice but is not conducive to
25 manipulating the output with unix tools. This option prints out‐
26 put plainly in a tab separated format.
27
28 -d Specify an alternative column delimiter. If no delimiter is
29 specified, columns will be delimited by a tab character if
30 pretty printing (-p) is turned off. If pretty printing is
31 enabled this option is meaningless.
32
33 -i Specify an input file. This option allows an input file contain‐
34 ing the SQL to be passed to mdb-sql. See Notes.
35
36 -o Specify an output file. This option allows the name of an output
37 file to be used instead of stdout.
38
40 mdb-sql in interactive mode takes some special commands.
41
42 connect to <database>
43 If no database was specified on the command line this command is
44 necessary before any querys are issued. It also allows the
45 switching of databases once in the tool.
46
47 disconnect
48 Will disconnect from the current database.
49
50 go Each batch is sent to the parser using the 'go' command.
51
52 reset A batch can be cleared using the 'reset' command.
53
54 list tables
55 The list tables command will display a list of available tables
56 in this database, similar to the mdb-tables utility on the com‐
57 mand line.
58
59 describe table <table>
60 Will display the column information for the specified table.
61
62 quit Will exit the tool.
63
65 The currently implemented SQL subset is quite small, supporting only
66 single table queries, no aggregates, and limited support for WHERE
67 clauses. Here is a brief synopsis of the supported language.
68
69 select:
70 SELECT [* | <column list>] FROM <table> WHERE <where clause>
71
72 column list:
73 <column> [, <column list>]
74
75 where clause:
76 <column> <operator> <literal> [AND <where clause>]
77
78 operator:
79 =, =>, =<, <>, like, <, >
80
81 literal:
82 integers, floating point numbers, or string literal in single
83 quotes
84
86 When passing a file (-i) or piping output to mdb-sql the final 'go' is
87 optional. This allow constructs like
88
89 echo "Select * from Table1" | mdb-sql mydb.mdb
90
91 to work correctly.
92
93 The -i command can be passed the string 'stdin' to test entering text
94 as if using a pipe.
95
97 MDB_JET3_CHARSET
98 Defines the charset of the input JET3 (access 97) file. Default
99 is CP1252. See iconv(1).
100
101 MDBICONV
102 Defines the output charset. Default is UTF-8. mdbtools must have
103 been compiled with iconv.
104
105 MDBOPTS
106 semi-column separated list of options:
107
108 · use_index
109
110 · no_memo
111
112 · debug_like
113
114 · debug_write
115
116 · debug_usage
117
118 · debug_ole
119
120 · debug_row
121
122 · debug_props
123
124 · debug_all is a shortcut for all debug_* options
125
127 mdb-sql first appeared in MDB Tools 0.3.
128
130 gmdb2(1) mdb-export(1) mdb-hexdump(1) mdb-prop(1) mdb-ver(1) mdb-
131 array(1) mdb-header(1) mdb-parsecsv(1) mdb-schema(1) mdb-tables(1)
132 isql(1)
133
135 The mdb-sql utility was written by Brian Bruns.
136
138 The supported SQL syntax is a very limited subset and deficient in sev‐
139 eral ways.
140
141
142
143MDBTools 0.7.1 17 February 2019 mdb-sql(1)