update query in mysql

UPDATE statement is used to update existing records in a table

Update single column

UPDATE customers SET last_name = 'habib' WHERE customer_id = 231;

Update multiple columns

UPDATE customers SET state = 'bihar', customer_age = 32 WHERE customer_id > 100;

How to update multiple record in one column.

UPDATE itechxpert SET status = 7 WHERE emp_id IN (10,12,15);

Update table with data from another table

UPDATE customers SET city = (SELECT city FROM suppliers WHERE suppliers.supplier_name = customers.customer_name) WHERE customer_id > 2000;

Update multiple Tables

UPDATE customers, suppliers SET customers.city = suppliers.city WHERE customers.customer_id = suppliers.supplier_id;

Replace and Update

UPDATE `ittutorial` SET crated_date = REPLACE(created_date, '1986-01-01', '2020-05-07') WHERE crated_date LIKE '%1986-01-01%'

UPDATE customers SET customers.city = 'Ara' WHERE customer_id >=10 AND customer_id <=20;





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here


Ittutorial