hi - im new to using postgresql - just wonderin if anyone can tell me whether i can make a calumn in a table have a unique value. i tried this:
create table search(id serial, name varchar(50) UNIQUE not null default 'n/a', info text, primary key ("id"));
but i get a parse error at "unique" - is there any other way of doing this ?

    you could use a table level constraint for the UNIQUE constraint;

    CONSTRAINT name_unique UNIQUE(name)

    so...
    create table search(
    id serial,
    name varchar(50) not null default 'n/a', info text,
    CONSTRAINT search_pk PRIMARY KEY(id),
    CONSTRAINT name_unique UNIQUE(name)
    );

    hope that helps.

      Alguem knows a form more easy to install the PostgreSQL in windows !!!!!!

        Write a Reply...