SQL - how to alter info of a cell in table

Hello,
I am newbie on mysql and trying to edit my database from terminal under linux.
What I need to do is to change the information written in a cell in table.
Let me explain what I tried:

$ mysql -u mysqluser -p
$ show databases;
$ USE catalogue;
$ show tables ;
$ select * from phonebook;

it shows something like this:

+-------------+------------+--------+
| id | friend_name | age |
+-------------+------------+--------+
| 1 | Jaxier | 18 |
| 2 | Johanna | 26 |
| 3 | Johny | 25 |
| 4 | Lacatus | 18 |
| 5 | Julia | 25 |
+-------------+------------+---------+

What I want to do is to set age of Lacatus from 18 to 58

I tried below commands:

1)

$ update phonebook set id 4 SET age 58;

gives syntax error.

2)

$  ALTER phonebook ALTER id ALTER 4 SET age 58;

I 'd appreciate if you could explain what I should run in terminal

Thanks in advance
Boris

The mysql-documentation tells you in detail how to formulate the statment. For you example, if you'd like to change Lacatus age to 58 it would look like this:

update phonebook set age = 58 where id = 4;
1 Like

Voila! It's done! Thanks for your reply Cero.
I will also check that mysql documentation for other functions.

b.regards
Boris