Actually I did this sometime ago for my ruby on rails experiment. On my ubuntu machine
To start on creating the database, on postgres, as I said before, is very unlike mysql. In mysql, it is calling createdb on mysql shell. On postgres, you call on shell:
if something happen and you want to drop it, it is done by calling
then you call
here i assume, that you create a user, in postgresql server that is your name. Suppose the above command doesn’t doesn’t work, do this, which I only tested on ubuntu, on other you might need to login as postgres user:
sudo -u postgres psql
now you can create tables, which again, very different from mysql. With many similarity as well.
in the psql shell, create table like this:
create table contact(
id serial primary key,
Which very similar with mysql, except, why id is serial?
Well, it turn out that, there is no autoincrement on postgresql, but it have a serial, which is really an autoincrementing integer. So that’s interesting.
Actually this is just the very surface of postgresql sql. Actually, there is many features, that mysql don’t have or have it very recently. such as
– inheritance, you can, inherit from another table, ala oop. mysql don’t have that
– procedural language, which mysql, introduced stored procedure in mysql 5. not too long ago.
I barely touch this, so there is more adventure for me in the future