question regarding Example 2-4

From: yen <ryannecruz(at)yahoo(dot)com>
To: docs(at)postgresql(dot)org
Subject: question regarding Example 2-4
Date: 2005-02-18 00:43:34
Message-ID: 20050218004334.81557.qmail@web14306.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Hi.

I was reading the postgres tutorial and I was confused by this example. I'll post here the example and the given tables.

Example 2-1. The Suppliers and Parts Database

SUPPLIER SNO | SNAME | CITY SELLS SNO | PNO -----+---------+-------- -----+----- 1 | Smith | London 1 | 1 2 | Jones | Paris 1 | 2 3 | Adams | Vienna 2 | 4 4 | Blake | Rome 3 | 1 3 | 3 4 | 2 PART PNO | PNAME | PRICE 4 | 3 -----+---------+--------- 4 | 4 1 | Screw | 10 2 | Nut | 8 3 | Bolt | 15 4 | Cam | 25


SELECT PNAME, PRICE
FROM PART
WHERE PNAME = 'Bolt' AND
(PRICE = 0 OR PRICE < 15);
will lead to the result:
PNAME | PRICE --------+-------- Bolt | 15

From what I understand, the select statement should query the PART

table for records with PNAME equal to Bolt and having a PRICE of

either 0 or less tahn 15. The row with PNAME Bolt has a PRICE EQUAL

to 15 so the select statement should have resulted to an empty set.

Was my understanding wrong?

Thanks,

yen


---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'

Browse pgsql-docs by date

  From Date Subject
Next Message Viktor Vislobokov 2005-02-18 06:32:14 Updated Russian translation of the FAQ
Previous Message Hashem Masoud 2005-02-17 08:12:39 Minor corrections in xfunc.sgml