martes, abril 20, 2010

PostgreSQL from Shell or Terminal MAC OS X

If you wanto to learn SQL commands, if you know already that SQL commands are an standart, the way i do it is this:

You have to download:

Postgresql (in my case i have downloades the MAC OS version);

after the installation have been completed, from terminal access to:

cd /Library/Postgresql/8.4/bin

once you are in the directory.

create a test table:

"./createdb -U postgresql my_db"

this "./" run a bash scrip that have the instruction to create the table
the "-U" you let know witch user will use, in this case the root account name is "postgres", and "my_db" is the name of the table i have created.

then put the root password.

once the table was created

put this in terminal "\q"

Log on again

"./psql -U postgres my_db"

and you can try SQL commands.

here the documentation of Postgresql.

http://www.postgresql.org/docs/8.4/interactive/index.html

No hay comentarios.: