1untitled(January 31, 2006) untitled(January 31, 2006)
2
3
4
6 mdb-sql - SQL interface to MDB Tools
7
9 mdb-sql [-HFp] [-d <delimiter>] [-i <file>] [-o <file>] [<database>]
10
12 mdb-sql is a utility program distributed with MDB Tools.
13
14 mdb-sql allows querying of an MDB database using a limited SQL subset
15 language.
16
18 -H Supress header row.
19
20 -F Supress footer row.
21
22 -p Turn off pretty printing. By default results are printed in an
23 ascii table format which looks nice but is not conducive to
24 manipulating the output with unix tools. This option prints out‐
25 put plainly in a tab separated format.
26
27 -d Specify an alternative column delimiter. If no delimiter is
28 specified, columns will be delimited by a tab character if
29 pretty printing (-p) is turned off. If pretty printing is
30 enabled this option is meaningless.
31
32 -i Specify an input file. This option allows an input file contain‐
33 ing the SQL to be passed to mdb-sql. See Notes.
34
35 -o Specify an output file. This option allows the name of an output
36 file to be used instead of stdout.
37
39 mdb-sql in interactive mode takes some special commands.
40
41 connect to <database>
42 If no database was specified on the command line this command is
43 necessary before any querys are issued. It also allows the
44 switching of databases once in the tool.
45
46 disconnect
47 Will disconnect from the current database.
48
49 go Each batch is sent to the parser using the 'go' command.
50
51 reset A batch can be cleared using the 'reset' command.
52
53 list tables
54 The list tables command will display a list of available tables
55 in this database, similar to the mdb-tables utility on the com‐
56 mand line.
57
58 describe table <table>
59 Will display the column information for the specified table.
60
61 quit Will exit the tool.
62
64 The currently implemented SQL subset is quite small, supporting only
65 single table queries, no aggregates, and limited support for WHERE
66 clauses. Here is a brief synopsis of the supported language.
67
68 select:
69 SELECT [* | <column list>] FROM <table> WHERE <where clause>
70
71 column list:
72 <column> [, <column list>]
73
74 where clause:
75 <column> <operator> <literal> [AND <where clause>]
76
77 operator:
78 =, =>, =<, <>, like, <, >
79
80 literal:
81 integers, floating point numbers, or string literal in single
82 quotes
83
85 When passing a file (-i) or piping output to mdb-sql the final 'go' is
86 optional. This allow constructs like
87
88 echo "Select * from Table1" | mdb-sql mydb.mdb
89
90 to work correctly.
91
92 The -i command can be passed the string 'stdin' to test entering text
93 as if using a pipe.
94
96 mdb-sql first appeared in MDB Tools 0.3
97
99 The mdb-sql utility was written by Brian Bruns
100
102 The supported SQL syntax is a very limited subset and deficient in sev‐
103 eral ways.
104
105
106
107 untitled(January 31, 2006)