Simple sql question - Mailing list pgsql-novice

From Tore Lukashaugen
Subject Simple sql question
Date
Msg-id fe0lfo$1ov9$1@news.hub.org
Whole thread Raw
Responses Re: Simple sql question  (Sean Davis <sdavis2@mail.nih.gov>)
Re: Simple sql question  (Brian Hurt <bhurt@janestcapital.com>)
Re: Simple sql question  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hello,

I am new to Postgres and have an embarassingly simple question. I am running
v8.2 on Windows Vista although I don't think that has any bearing on the
answer.

create table test (col1 int, col2 int)
insert into test values (1,2);
select col1/col2 from test....yields 0 not 0.5 - why?

Presumably this is because both col1 and col2 are ints and the output needs
to be casted somehow? Or is it because PGAdmin's SQL interface does not by
default show the decimal places of output?

Appreciate your help.

Tore



pgsql-novice by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Implicit btree index from unique constraint versus explicit btree index
Next
From: Sean Davis
Date:
Subject: Re: Simple sql question