Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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'

pgsql-docs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group