Working with an Existing Database
In order to work with an existing database, you need to open it first. rdm-sql lets you open a database in two ways - by specifying the database name with a command-line option or by issuing a USE SQL statement.
Navigate to your working directory where you saved the bicycle_db database. Start rdm-sql with the following command-line argument.
$ rdm-sql --database BICYCLE_DB rdm-sql:
Or start rdm-sql with no command-line arguments and issue the following USE statement at the rdm-sql prompt.
rdm-sql: USE bicycle_db; rdm-sql:
Now you’re ready to work with the bicycle_db database. Let's execute a query to make sure the database contains the data that you entered.
Execute the following SQL statement at the prompt.
rdm-sql: SELECT m.name, b.model, b.type FROM manufacturer m LEFT JOIN bicycle b rdm-sql> ON m.name = b.make; NAME | MODEL | TYPE --------------------+---------------------+----------- Cannondale | Synapse | Road Specialized | *NULL* | *NULL* Trek | Domane | Road Trek | FX | Hybrid *** 4 row(s) returned
Type ".q" at the prompt to quit rdm-sql.
rdm-sql: .q