update query in sql

Hello developers! In this post I have shared the details about “update query in sql”. Okay, let’s move on to the article.

update query in sql

UPDATE table_name
 SET column_name1 = value1, column_name2 = value2
 WHERE condition; 
UPDATE YourTable 
SET Col1 = OtherTable.Col1, 
    Col2 = OtherTable.Col2 
FROM (
    SELECT ID, Col1, Col2 
    FROM other_table) AS OtherTable
WHERE 
    OtherTable.ID = YourTable.ID
UPDATE `table_name`
	SET `status` = 'offline' 
		WHERE `id` = 2386;
SQL> UPDATE CUSTOMERS
SET ADDRESS = 'Pune'
WHERE ID = 6;

  Update salesTransaction
  Set Unit_Price=45.41,Item_Number="Milk-1"
  Where trx_id=1249
-- sql update using string format 
String = "UPDATE yourtable SET yourcolumn = '" + yourvealueintext + "' WHERE column = " + item_to_compare_the_position_of_Your_Column;
                                           -- or                                            
String = "UPDATE yourtable SET yourcolumn = " + yourvalue_in_number + " WHERE column = " + item_to_compare_the_position_of_Your_Column;

Final Words

I hope this post helps you to know about “update query in sql”. If you have any queries regarding this post please let us know via the comment section. Share this tutorial with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment