MYSQL07: Updating a table
To edit or modify existing data in a table UPDATE command is
used. The syntax is as follows:
UPDATE tableName SET field1 = value1,
field2 = value2... WHERE condition
for example
UPDATE students SET name = ‘Jamie’
WHERE name = ‘Joe’;
this will replace the existing name value to new one, in
records meeting the condition. This will change the name Joe to Jamie. To check
the value is updated, we issue select all
SELECT * FROM students ;
Id
|
name
|
age
|
1
|
Calvin
|
12
|
2
|
Jamie
|
15
|
3
|
Rosy
|
17
|
Comments
Post a Comment