Selasa, 16 Agustus 2016

[Step 07] How to update the data in the table


In this post Becoding.tk will teach you how to update or alter existing data in the database table.
Basically command is
update table_name set field_target=new_value where criteria;

*Notes
table_name:the name of the table whose data you want to change.
field_target:the value of a field you wish to edit.
new_value:The new value is entered
criteria:unique data that are characteristic of the data that we want to change (usually always code).
On learning Step 6 first we have to have one database and one table "items". re-entry into the database.
if you do not have a database and a table please visit the following link

[Step 06] how to display the data in a database table mysql 

Then we will show all existing data as follows:
ScreenShot: Database & Table [Click Here] 

Then we'll try to update the data of the item "NEXUS 7" where the price of 3.2 million will be converted into 3.5 million.
then the command is

update items set price='3500000' where items_id='A001';

*Notes
table_name:items
field_target:price
new_value:3500000
criteria:items_id='A001'(because the codec 'A001' is a unique code of the item 'NEXUS 7')
after trying, recheck whether the update was successful.
ScreenShot: Update data [Click Here] 

That's how to update the data from a table in the mysql database. I hope this study can help you gentlemen, thank you for reading until the end.

Tidak ada komentar:

Posting Komentar