Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EFF66633224 for ; Wed, 1 Jul 2009 13:36:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 83696-06 for ; Wed, 1 Jul 2009 13:36:42 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f178.google.com (mail-px0-f178.google.com [209.85.216.178]) by mail.postgresql.org (Postfix) with ESMTP id C5631633208 for ; Wed, 1 Jul 2009 13:36:42 -0300 (ADT) Received: by pxi8 with SMTP id 8so1207577pxi.29 for ; Wed, 01 Jul 2009 09:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=ChuzDeL3ocvVTgFUvQ8kHSg1pLZBbEFKp9DZ4grarGQ=; b=SCp7RUznmWsP65TXNitsm7wqzluiimDcQemOLeSRIr/9gimwjK3Lj5OjwAkM2tHjR2 iBV7wXBIMxh7yO31oOzRaGARShdPIXuoHoCiwOACcbczO/Bk9fL3fYpvXSnAxcLCVyDn pXxkED2h6xXk6Den9dwK03xzUMMiUskQoPxVY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=lTnxmNn2GfeB4YHKNYZ+w2UPDfBN8w2GCevTuYVkfSI6cVJ2Ziy7apH55DkTILKmeM UPCLzo8U03kKRW6BgjUy6dEJkMbj21TRhwjbgKubiLQ6so1YscsxOEZaT2cZh6Z3UDIM LnFGUnbDYiAyBWQM+n4GDcswCf8fRuRQd4Mls= Received: by 10.114.37.1 with SMTP id k1mr15820677wak.194.1246466201481; Wed, 01 Jul 2009 09:36:41 -0700 (PDT) Received: from ?192.168.0.9? (rsargent.dsl.xmission.com [199.104.125.126]) by mx.google.com with ESMTPS id n6sm2371703wag.39.2009.07.01.09.36.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Jul 2009 09:36:40 -0700 (PDT) Message-ID: <4A4B9096.5020704@gmail.com> Date: Wed, 01 Jul 2009 10:36:38 -0600 From: Rob Sargent User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Tena Sakai CC: pgsql-sql@postgresql.org Subject: Re: it's not NULL, then what is it? References: <690707f60906301849s68eb934ck33db888c87a39087@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/2 X-Sequence-Number: 32743 So they were null, and null turns out to be a seven-character blank string!? Btw, you can change the displayed value of null with \pset null nil and you will seem 4+ million 'nil's in your output Tena Sakai wrote: > > Hi Osvaldo, > > > Try: > > SELECT count(*) FROM gallo.sds_seq_reg_shw; > > SELECT count(*) FROM gallo.sds_seq_reg_shw WHERE maf IS NULL; > > SELECT count(*) FROM gallo.sds_seq_reg_shw WHERE maf IS NOT NULL; > > > Don't use count(maf), use count(*). > > Indeed! > > canon=# SELECT count(*) FROM gallo.sds_seq_reg_shw; > count > --------- > 4645647 > (1 row) > > canon=# SELECT count(*) FROM gallo.sds_seq_reg_shw WHERE maf IS NULL; > count > --------- > 4578363 > (1 row) > > canon=# SELECT count(*) FROM gallo.sds_seq_reg_shw WHERE maf IS NOT > NULL; > count > ------- > 67284 > (1 row) > > $ dc > 4578363 67284 + p q > 4645647 > $ > > Many thanks, Osvald. > > Regards, > > Tena Sakai > tsakai@gallo.ucsf.edu > > > > > -----Original Message----- > From: Osvaldo Kussama [mailto:osvaldo.kussama@gmail.com] > Sent: Tue 6/30/2009 6:49 PM > To: Tena Sakai > Subject: Re: [SQL] it's not NULL, then what is it? > > 2009/6/30 Tena Sakai : > > Hi Everybody, > > > > I have a table called gallo.sds_seq_reg_shw, > > which is like: > > > > canon=# \d gallo.sds_seq_reg_shw > > Table "gallo.sds_seq_reg_shw" > > Column | Type | Modifiers > > ------------------+---------+----------- > > name | text | > > response | text | > > n | integer | > > source | text | > > test | text | > > ref | text | > > value | real | > > pvalue.term | real | > > stars.term | text | > > gtclass.test | text | > > fclass.test | text | > > gtclass.ref | text | > > fclass.ref | text | > > markerid | integer | > > maf | real | > > chromosome | text | > > physicalposition | integer | > > id | text | > > ctrast | text | > > > > I am intereseted in the column maf (which is real): > > > > canon=# select maf from gallo.sds_seq_reg_shw > > canon-# order by maf asc; > > maf > > ------------- > > 0.000659631 > > 0.000659631 > > 0.000659631 > > 0.000659631 > > . > > (trunacated for the interest of breivity) > > . > > > > Another way to look at this column is: > > > > canon=# select maf from gallo.sds_seq_reg_shw > > canon-# order by maf desc; > > maf > > ------------- > > > > > > > > . > > (trunacated for the interest of breivity) > > . > > > > These rows shown are blanks, as far as I can tell. > > But... > > > > canon=# select count(maf) from gallo.sds_seq_reg_shw; > > count > > ------- > > 67284 > > (1 row) > > > > canon=# select count(maf) from gallo.sds_seq_reg_shw > > canon-# where maf ISNULL; > > count > > ------- > > 0 > > (1 row) > > > > canon=# > > canon=# select count(maf) from gallo.sds_seq_reg_shw > > canon-# where maf NOTNULL; > > count > > ------- > > 67284 > > (1 row) > > > > My confusion is that if they are real and not null, > > what are they? How would I construct a query to do > > something like: > > > > select count(maf) > > from gallo.sds_seq_reg_shw > > where maf ISBLANK; > > > > > Try: > SELECT count(*) FROM gallo.sds_seq_reg_shw; > SELECT count(*) FROM gallo.sds_seq_reg_shw WHERE maf IS NULL; > SELECT count(*) FROM gallo.sds_seq_reg_shw WHERE maf IS NOT NULL; > > Don't use count(maf), use count(*). > > Osvaldo >