RA is a simple relational algebra interpreter, with full documentation at the public RA website. It has already been installed on your VM, and customized for this course to run on databases managed by the PostgreSQL server running on your VM.
To create/restore the example beers
database in PostgreSQL (used as a running example on the public RA website), run “/opt/dbcourse/examples/db-beers/setup.sh
” from your VM shell. Then, you can connect RA to your beers
database by issuing the following command:
radb beers
(If you have a different database to connect to, just replace beers
above with the database name.)
Once you are inside RA, refer to the public RA website for syntax of commands and relational algebra queries. You should skip “Getting Started,” just start reading from “Basic Usage.”
Warning: If you want to follow the RA example queries on the public website above, beware that tables in your PostgreSQL database are all lower-case (as opposed to capitalized), so make sure you make table names in your RA queries lower-case (e.g.,
drinker
).
Check out “Advance Usage” for more information. In particular, here are some useful tips:
- Running
radb
with the verbose option-v
will print extra information helpful for debugging your query. - Are your queries getting too complicated, and would you rather like to think/write in steps? Use RA views.
- Do you need to get away from RA for a while without losing your work so far? You can save your views into a file and restore them later when you restart RA; see “Views” and “Other Features” for details.
- By default RA starts in an interactive mode, but you can run RA in a non-interactive mode instead, where it will read commands from an input file and write the result to an output file:
radb dbname -i inputfile.txt > -eo outputfile.txt