one for the mysql server gurus

Temlakos temlakos at gmail.com
Mon Jul 25 14:01:51 UTC 2005


VJ wrote:
> I am no guru, but I carried out the following test
> 
> mysql> select * from t;
> +------+-------+
> | c1   | c2    |
> +------+-------+
> |    1 | hello |
> |    2 | hello |
> |    3 | NULL  |
> |    4 | NULL  |
> |    5 | Helly |
> |    6 | Nelly |
> |    7 | Kelly |
> +------+-------+
> 7 rows in set (0.00 sec)
> 
> mysql> update t set c2 = replace(t2,'hell', 'heaven');
> ERROR 1054: Unknown column 't2' in 'field list'
> mysql> update t set c2 = replace(c2,'hell', 'heaven');
> Query OK, 2 rows affected (0.00 sec)
> Rows matched: 7  Changed: 2  Warnings: 0
> 
> mysql> select * from t;
> +------+---------+
> | c1   | c2      |
> +------+---------+
> |    1 | heaveno |
> |    2 | heaveno |
> |    3 | NULL    |
> |    4 | NULL    |
> |    5 | Helly   |
> |    6 | Nelly   |
> |    7 | Kelly   |
> +------+---------+
> 7 rows in set (0.01 sec)
> 
> 
> The update statement found 7 rows (all of the rows in my table bcos
> there was no where clause, and only two rows actually got updated.
> 
> 
> Regards from VJ
> 

I'm no MySQL guru, but I /do/ work with PostgreSQL. And SQL is SQL.

I think Row 5 didn't get an update because an UPDATE <column> SET <old> 
TO <new> WHERE <condition> command is case-sensitive. "Hell" and "hell" 
are two different character sequences.

Temlakos




More information about the fedora-list mailing list