1mdb-sql(1)           Executable programs or shell commands          mdb-sql(1)
2
3
4

NAME

6       mdb-sql - SQL interface to MDB Tools
7

SYNOPSIS

9       mdb-sql [-HFp] [-d char] [-i file] [-o file] [database]
10       mdb-sql -h|--help
11       mdb-sql --version
12
13

DESCRIPTION

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

OPTIONS

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

COMMANDS

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

SQL LANGUAGE

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, <, >
96
97       literal:
98              integers,  floating  point  numbers, or string literal in single
99              quotes
100

NOTES

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

ENVIRONMENT

113       LC_COLLATE
114              Defines the locale for  string-comparison  operations.  See  lo‐
115              cale(1).
116
117       MDB_JET3_CHARSET
118              Defines  the charset of the input JET3 (access 97) file. Default
119              is CP1252. See iconv(1).
120
121       MDBICONV
122              Defines the output charset. Default is UTF-8. mdbtools must have
123              been compiled with iconv.
124
125       MDBOPTS
126              Colon-separated list of options:
127
128              •  debug_like
129
130              •  debug_write
131
132              •  debug_usage
133
134              •  debug_ole
135
136              •  debug_row
137
138              •  debug_props
139
140              •  debug_all is a shortcut for all debug_* options
141
142              •  no_memo (deprecated; has no effect)
143
144              •  use_index (experimental; requires libmswstr)
145

HISTORY

147       mdb-sql first appeared in MDB Tools 0.3.
148

SEE ALSO

150       mdb-array(1)  mdb-count(1)  mdb-export(1)  mdb-header(1) mdb-hexdump(1)
151       mdb-import(1) mdb-json(1)  mdb-parsecsv(1)  mdb-prop(1)  mdb-queries(1)
152       mdb-schema(1) mdb-tables(1) mdb-ver(1) isql(1)
153

AUTHORS

155       The mdb-sql utility was written by Brian Bruns.
156

BUGS

158       The supported SQL syntax is a very limited subset and deficient in sev‐
159       eral ways.
160
161
162
163MDBTools 0.9.3                  20 January 2022                     mdb-sql(1)
Impressum