Once you have created a database, you can access it by:
Running the PostgreSQL interactive terminal program, called psql, which allows you to interactively enter, edit, and execute SQL commands.
Using an existing graphical frontend tool like PgAccess or ApplixWare (via ODBC) to create and manipulate a database. These possibilities are not covered in this tutorial.
Writing a custom application, using one of the several available language bindings. These possibilities are discussed further in The PostgreSQL Programmer's Guide.
You probably want to start up psql, to try out the examples in this tutorial. It can be activated for the mydb database by typing the command:
$ psql mydb
If you leave off the database name then it will default to your user account name. You already discovered this scheme in the previous section.
In psql, you will be greeted with the following message:
Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit mydb=>
mydb=#
The last line printed out by psql is the prompt, and it indicates that psql is listening to you and that you can type SQL queries into a work space maintained by psql. Try out these commands:
mydb=> SELECT version(); version ---------------------------------------------------------------- PostgreSQL 7.2devel on i586-pc-linux-gnu, compiled by GCC 2.96 (1 row) mydb=> SELECT current_date; date ------------ 2001-08-31 (1 row) mydb=> SELECT 2 + 2; ?column? ---------- 4 (1 row)
mydb=> \h
mydb=> \q