|
データベースを作成したので、再び"psql"を起動してみます。
$ psql test
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.2 on i586-pc-linux-gnu, compiled by gcc 2.95.2]
type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: test
test=>
"psql"を起動すると上記のようなメッセージが表示されます。
"psql"で使用可能なコマンドは"\?"で機能一覧を表示する事ができます。
test=> \?
\? -- help
\a -- toggle field-alignment (currently on)
\C [<captn>] -- set html3 caption (currently '')
\connect <dbname|-> <user> -- connect to new database
(currently 'fuku')
\copy table {from | to} <fname>
\d [<table>] -- list tables and indices, columns in <table>,
or * for all
\da -- list aggregates
\dd [<object>]- list comment for table, field, type, function,
or operator.
\df -- list functions
\di -- list only indices
\do -- list operators
\ds -- list only sequences
\dS -- list system tables and indexes
\dt -- list only tables
\dT -- list types
\e [<fname>] -- edit the current query buffer or <fname>
\E [<fname>] -- edit the current query buffer or <fname>,
and execute
\f [<sep>] -- change field separater (currently '|')
\g [<fname>] [|<cmd>] -- send query to backend [and results
in <fname> or pipe]
\h [<cmd>] -- help on syntax of sql commands, * for all commands
\H -- toggle html3 output (currently off)
\i <fname> -- read and execute queries from filename
\l -- list all databases
\m -- toggle monitor-like table display (currently off)
\o [<fname>] [|<cmd>] -- send all query results to stdout,
<fname>, or pipe
\p -- print the current query buffer
\q -- quit
\r -- reset(clear) the query buffer
\s [<fname>] -- print history or save it in <fname>
\t -- toggle table headings and row count (currently on)
\T [<html>] -- set html3.0 <table ...> options (currently
'')
\x -- toggle expanded output (currently off)
\w <fname> -- output current buffer to a file
\z -- list current grant/revoke permissions
\! [<cmd>] -- shell escape or command
上記がその一覧です。
"psql"上では、これらの機能と、任意のSQL文を実行する事ができます。
|