At 11:27 -0500 7/4/03, Richard Grubb wrote:
I have mysql 3.23.49 on Mac OS-X 10.1.5 and am going through the tutorial in the "MySQL Reference Manual" in Chapter 3.

I get an empty set with the following command:

SELECT * FROM pet WHERE birth >= "1998-1-1";

I have tried many variations which all give either the empty set or incorrect results.

For instance,
SELECT * FROM pet WHERE 'birth' >= "1998-1-1";

You've quoted 'birth' here, so you're performing a string comparison. For the rows below, 'birth' is indeed lexically greater than "1998-1-1".

+----------+--------+---------+------+------------+------------+
| name     | owner  | species | sex  | birth      | death      |
+----------+--------+---------+------+------------+------------+
| Fluffy   | Harold | cat     | f    | 1993-02-04 | NULL       |
| Claws    | Gwen   | cat     | m    | 1994-03-07 | NULL       |
| Buffy    | Harold | dog     | f    | 1989-05-13 | NULL       |
| Fang     | Benny  | dog     | m    | 1990-08-27 | NULL       |
| Bowser   | Diane  | dog     | m    | 1989-08-31 | 1995-07-29 |
| Chirpy   | Gwen   | bird    | f    | 1098-08-11 | NULL       |
| Whistler | Gwen   | bird    |      | 1997-12-09 | NULL       |
| Slim     | Benny  | snake   | m    | 1996-04-29 | NULL       |
+----------+--------+---------+------+------------+------------+
 or
select * from pet where birth > "1997-1-1";

This result does indeed not look correct. Hm -- I get the correct result (3 rows) with Mac OS X (10.2.6) with MySQL 4.0.14. What happens when you use "1997-01-01" instead?

+----------+-------+---------+------+------------+-------+
| name     | owner | species | sex  | birth      | death |
+----------+-------+---------+------+------------+-------+
| Whistler | Gwen  | bird    |      | 1997-12-09 | NULL  |
+----------+-------+---------+------+------------+-------+
1 row in set (0.00 sec)

Is there something wrong with my table? I had to give myself FILE privileges before I could load my table data from a file. (The tutorial didn't mention that.)

The tutorial uses LOAD DATA LOCAL rather than LOAD DATA; with LOCAL you shouldn't need the FILE privilege.


Is there something wrong with my installation?


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to