[vox-tech] mysql question: changing a record

vox-tech@lists.lugod.org vox-tech@lists.lugod.org
Sat, 10 Apr 2004 16:12:59 -0700


On Sat, Apr 10, 2004 at 03:50:10PM -0700, Peter Jay Salzman wrote:
> yah.  so this changes the name of the variable.  if i wanted to change

Well, no. Changing the name of the column would be done with:

(sorry, this is off the top of my head, check mysql.org)
ALTER table CHANGE column new_name create_definition.

so,

ALTER slash CHANGE value bear varchar(255) NOT NULL;
					old	  new	definition


> the value of the variable, it would be:
> 
>  	mysql> UPDATE var
>  		-> SET value = 'aspell'
>  		-> WHERE name = 'ispell';
> 
> in other words, you SET field names, not individual records under the

You set the value of a column. Your above example would change all rows that
have a column 'name' matching 'ispell' to have a column 'value' matching 
'aspell'

> field name.   does this mean that:
> 
>  	mysql> UPDATE var
>  		-> SET name = 'foo';
> 
> would change each record's name in the var table to "foo"?

Correct. So if you wanted to set all records to belong to you, you could say
UPDATE books SET owner = 'Pete';

-Gabe

ps. this is all off the top of my head, it may be a little off :)