-1

I would like to update value in productcatergory from bike to bikes in id 1 (row)

mysql> select * from productsale;
+----+------------------+--------+------------------+--------------+-------------+-------------+-----------+------------+
| id | productcatergory | color  | productname      | standardcost | dealerprice | salesamount | taxamount | orderdate  |
+----+------------------+--------+------------------+--------------+-------------+-------------+---------
|  1 | bike             | yellow | road-550-w,38    |          413 |         419 |         699 |        56 | 2015-05-25 |
|  2 | bikes            | black  | Road-650,58      |          413 |         419 |         699 |        56 | 2015-05-10 |
|  3 | components       | black  | HL Road Frame,44 |          413 |         419 |         699 |        56 | 2015-04-29 |
+----+------------------+--------+------------------+--------------+-------------+-------------+---------

kindly help me how to do?

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
user263850
  • 39
  • 5
  • 5
    Come on, you can do this yourself, at least try something. [That](https://dev.mysql.com/doc/refman/8.0/en/update.html)'s worth a read for you. – sticky bit Mar 07 '20 at 02:22
  • If you are encountering an issue with performing this update that hasn't been covered by another question -which I doubt, it's definitely worth some searching- then please include the issue's details and what you've tried. – zbee Mar 07 '20 at 04:33
  • This is very specific, just a simple `UPDATE` with `WHERE id=1`. But your question might actually be something more than just _I want to update `bike` to `bikes` in id 1.._ Maybe something like _**How do I find all Id that have almost similar value like `bike` and `bikes` and update them to `bikes` or all id with almost similar value like `component` and `components` and update them all to `components` without having to search and update one by one?**_ .. .then that's a different question altogether.. – FanoFN Mar 07 '20 at 06:09
  • Does this answer your question? [Update a column in MySQL](https://stackoverflow.com/questions/6503824/update-a-column-in-mysql) – Christoph Kluge Mar 07 '20 at 08:32

1 Answers1

0

You should try to read the link provided by sticky bit. Following is one way to update column in specific row:

UPDATE productsale
SET productcatergory = 'bikes'
WHERE id = 1
Khurram Ishaque
  • 778
  • 1
  • 9
  • 26
  • thanks for the help it worked. i have tried in different formats but i didn't work.I have doubt . suppose if want to change name on productcatergory to productcategory. how can i do – user263850 Mar 10 '20 at 01:33
  • For changing column name, you may use Alter Table command. Pls read docs of sql on this. And try to read tutorials first. – Khurram Ishaque Mar 10 '20 at 01:41