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'

Reply via email to