Logo Lexonics
SM

Home
About Lexonics
Lexonics Consulting Services
Lexonics Learning Services
Lexonics Technology
Valid HTML 4.01! Valid CSS!
info@lexonics.com
Edsel
SqlMinus

Innovation. Correctness. Soundness.

SqlMinus is a SQL*Plus-like program for querying Oracle databases, supporting a relational-algebra query language as well as SQL.

Download the 1.0 zip and unzip it. Edit the shell script sqlminus or the batch file sqlminus.bat to define appropriate values for the JAVA_HOME and SQLMINUS_HOME environment variables. When you run the shell script or batch file, type help for a command summary. You should see output like this:

USAGE
  sqlminus [-q]

    If there is a readable file named .sqlminusrc in the home directory,
    commands in it are processed first.

    Specifying -q causes standard output and standard error suppression.

COMMANDS

(In the following, u/p@h:p:s stands for <user>/<password>@<host>:<port>:<sid>.)

  c <table>               - list the check constraints of <table>
  columns <table>         - list the columns of <table>
  connect <name>          - connect to the indicated schema
  connect u/p@h:p:s       - connect to the indicated schema
  do <file>               - process commands from <file>
  do <macro>              - process commands from <macro>
  echo (on | off)         - turn query echoing on or off
  fk (to | from) <table>  - list the foreign keys to or from <table>
  h                       - print command history
  help                    - print this text
  help raquel             - print help text about RAQueL
  keys <table>            - list the keys of <table>
  macro                   - list all the macros
  macro <macro>           - define a macro
    ...
    endmacro
  pk <table>              - list the primary key of <table>
  <query>;                - execute SQL <query> (may span lines)
  quit                    - return from the current input source
  r [<n>] [s/<a>/<b>/]    - repeat history item <n> (default last), optionally
                            replacing <a> by <b>
  raquel <statement>;     - execute RAQueL <statement> (may span lines)
  sa                      - list all the schema aliases
  sa <name>=u/p@h:p:s     - define a schema alias
  sequences               - list all the sequences
  tables                  - list all the tables
  u <table>               - list the unique constraints of <table>
  version                 - show the sqlminus version
  whereami                - show the current schema connection
If you want to learn about RAQueL, type help raquel. You should see output like this:
RAQueL is a Relational Algebra Query Language,
inspired by the work of T. M. Vijayaraman (see
http://www.ncst.ernet.in/education/pgdst/dbmsfac/assignments/RaQuel/RaQuel.pdf).

A RAQueL statement may be a relation expression.

The simplest form of RAQueL relation expression is simply a table name:

  ? raquel gt_boms;
  +-----------------------------------------------------------------+
  | PACKAGE_ID | VERSION | NAME     | DISPLAY_NAME    | DESCRIPTION |
  +-----------------------------------------------------------------+
  | 1          | 0       | package1 | displayPackage1 | null        |
  | 2          | 0       | package2 | displayPackage2 | null        |
  +-----------------------------------------------------------------+

A RAQueL relation expression may be followed by a "projection" in square
brackets, to select columns:

  ? raquel gt_boms [name, display_name];
  +----------------------------+
  | NAME     | DISPLAY_NAME    |
  +----------------------------+
  | package1 | displayPackage1 |
  | package2 | displayPackage2 |
  +----------------------------+

A RAQueL relation expression may be followed by a "selection" in braces, to
select rows:

  ? raquel gt_boms [name, display_name] {name like '%2'};
  +----------------------------+
  | NAME     | DISPLAY_NAME    |
  +----------------------------+
  | package2 | displayPackage2 |
  +----------------------------+

A RAQueL relation expression may be followed by a "renaming" in angle brackets,
to rename columns:

  ? raquel gt_companies;
  +------------------------------------------------------------------------+
  | COMPANY_ID | NAME           | VERSION | CODE | DESCRIPTION             |
  +------------------------------------------------------------------------+
  | 17         | DbUnit Airline | 1       | DBU  | Test airline for DbUnit |
  | 37         | Fobbling       | 0       | FOBB | Fobbling description    |
  +------------------------------------------------------------------------+

  ? raquel gt_companies <c_version = version>;
  +--------------------------------------------------------------------------+
  | COMPANY_ID | NAME           | C_VERSION | CODE | DESCRIPTION             |
  +--------------------------------------------------------------------------+
  | 17         | DbUnit Airline | 1         | DBU  | Test airline for DbUnit |
  | 37         | Fobbling       | 0         | FOBB | Fobbling description    |
  +--------------------------------------------------------------------------+

A relation expression may be named for later use:

  ? raquel let x = gt_boms [name, display_name];

  ? raquel x;
  +----------------------------+
  | NAME     | DISPLAY_NAME    |
  +----------------------------+
  | package1 | displayPackage1 |
  | package2 | displayPackage2 |
  +----------------------------+

  ? raquel x [display_name];
  +-----------------+
  | DISPLAY_NAME    |
  +-----------------+
  | displayPackage1 |
  | displayPackage2 |
  +-----------------+

The ^ operator means "natural join:"

  ? raquel let company = gt_companies
  > <c_version = version, c_description = description, c_name = name>;

  ? raquel let entity = gt_entities
  > <e_version = version, e_description = description, e_name = name>;

  ? raquel (company ^ entity) [c_name, e_name];
  +-----------------------------+
  | C_NAME         | E_NAME     |
  +-----------------------------+
  | DbUnit Airline | Recipient1 |
  | DbUnit Airline | Recipient2 |
  +-----------------------------+

Relation constants may be used:

  ? raquel let states = <name, capitol>
  > {<'Colorado', 'Denver'>, <'Arizona', 'Phoenix'>};

  ? raquel states;
  +--------------------+
  | NAME     | CAPITOL |
  +--------------------+
  | Arizona  | Phoenix |
  | Colorado | Denver  |
  +--------------------+

Unlike SQL result sets, RAQueL relations are sets (not lists):

  ? raquel <foo> {<3>, <3>};
  +-----+
  | FOO |
  +-----+
  | 3   |
  +-----+

Unlike SQL result sets, a RAQueL relation may have zero columns:

  ? raquel <> {};
  +--+
  |  |
  +--+
  +--+

A zero-column relation may have, of course, at most one tuple:

  ? raquel <> {<>};
  +--+
  |  |
  +--+
  |  |
  +--+

Use the *, +, - operators for intersection, union, difference respectively:

  ? raquel let x = <foo> {<3>, <4>};

  ? raquel let y = <foo> {<4>, <5>};

  ? raquel x * y;
  +-----+
  | FOO |
  +-----+
  | 4   |
  +-----+

  ? raquel x + y;
  +-----+
  | FOO |
  +-----+
  | 3   |
  | 4   |
  | 5   |
  +-----+

  ? raquel x - y;
  +-----+
  | FOO |
  +-----+
  | 3   |
  +-----+