|
Accessing a DatabaseOnce you have constructed a database, you can access it by:
% psql mydbYou 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=> This prompt indicates that psql is listening to you and that you can type SQL queries into a workspace maintained by the terminal monitor. The psql program responds to escape codes that begin with the backslash character, "\". For example, you can get help on the syntax of various PostgreSQL SQL commands by typing: mydb=> \hOnce you have finished entering your queries into the workspace, you can pass the contents of the workspace to the Postgres server by typing: mydb=> \gThis tells the server to process the query. If you terminate your query with a semicolon, the "\g" is not necessary. psql will automatically process semicolon terminated queries. To read queries from a file, say myFile, instead of entering them interactively, type: mydb=> \i fileNameTo get out of psql and return to Unix, type mydb=> \qand psql will quit and return you to your command shell. (For more escape codes, type \? at the psql prompt.) White space (i.e., spaces, tabs and newlines) may be used freely in SQL queries. Single-line comments are denoted by "--". Everything after the dashes up to the end of the line is ignored. Multiple-line comments, and comments within a line, are denoted by "/* ... */". Database PrivilegesTable PrivilegesTBD |
|||||||||||||||||
With any suggestions or questions please feel free to contact us |