I am in the midst of refreshing myself on MySQL.

The basics have been going well but I am having one issue. I have created a table with two columns and three rows. Next I added a third, null column, Price, which I now wish to populate with data, that is, I want to enter separate, new data for each row in the Price column. Below is the output of the table:

Name | Color | Price
Apples | Red | Null
Kiwis | Green | Null
Berries | Blue | Null

I would like to alter the output to this:

Name | Color | Price
Apples | Red | 1.00
Kiwis | Green | 1.50
Berries | Blue | 2.25

*Note: I have researched this but have not yet found the solution

Thank-you in advance for any help.

7 Years
Discussion Span
Last Post by tesuji
UPDATE yourtable SET price=1 WHERE Name='Apples';

It would be really easier and SAVER if you table has primary key.
Consider that

UPDATE yourtable SET price=1;

changes all three rows.

-- tesu

Edited by tesuji: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.