Tips psql

klu kita mau liat nama-nama tabel dalam database…
psql -h hostnya -U usernya namadb
ex: psql -h 192.168.1.255 -U muki muki_mini
psql -U muki muki_mini (JIKA LOCALHOST)

muki_mini=# \d
Schema |          Name           | Type  | Owner
-------+-------------------------+-------+-------
public | acc                     | table | muki
public | accbal                  | table | muki
public | accgrp                  | table | muki

klu kita mau liat info-info yang ada pada tabel tertentu
muki_mini=# \d acc
“muki_mini=# \d nama tabel”

              Table "public.acc"
Column   |         Type          |   Modifiers
-----------+-----------------------+---------------
accno     | character varying(10) | not null
acctype   | character varying(5)  |
acctype1b | character varying(5)  |
crcid     | character varying(5)  |
accgrpid  | character varying(5)  |
acctype2  | character varying(5)  |
accname   | character varying(50) |
accdk     | character varying(1)  |
openbal   | numeric(19,4)         | default 0
opendate  | date                  |
isheader  | boolean               | default false
upaccno   | character varying(10) |
acclevel  | smallint              |
accbal    | numeric(19,4)         | default 0

Indexes:
"pk_acc" PRIMARY KEY, btree (accno)
"acc_pk" UNIQUE, btree (accno)
"relationship_132_fk" btree (upaccno)
"relationship_305_fk" btree (accgrpid)
"relationship_306_fk" btree (acctype)

klu kita bingung ya pake cara final dan manjur abiss…..
muki_mini=# \?
ini untuk help……..

Advertisements