Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

SQL

Learn step by step



SQL - Update query

Update query is used to make an update in the table data.
Synatax

UPDATE "table_name"
SET "column_1" = [new value]
WHERE "condition";

Example, say we have a table as shown below:

ID First_Name Last_Name Father_Name Age Address ContactNo
101 Jai Soni Dinesh Soni 23 jaipur, ram nagar b-007,h-786 4586859
102 Prakash tak Sivaji tak 34 delhi, rai nagar b-07,h-76 54886859
103 Ramesh jain Surajprakash jain 23 ajmer, suraj nagar b-258,h-746 1234568
104 Rahul Tanvar Dhyanchand tanvar 25 ajmer, ram nagar b-278,h-366 65489645
105 Aameer Khan aasif khan 26 mumbai, aajad nagar 1232584


Update TblStudent SET Age=45 where
ID=105 AND Frist_Name='Aameer';

OutPut

After update query , make select query on TblStudent.

ID First_Name Last_Name Father_Name Age Address ContactNo
101 Jai Soni Dinesh Soni 23 jaipur, ram nagar b-007,h-786 4586859
102 Prakash tak Sivaji tak 34 delhi, rai nagar b-07,h-76 54886859
103 Ramesh jain Surajprakash jain 23 ajmer, suraj nagar b-258,h-746 1234568
104 Rahul Tanvar Dhyanchand tanvar 25 ajmer, ram nagar b-278,h-366 65489645
105 Aameer Khan aasif khan 45 mumbai, aajad nagar 1232584


Update More than One columns value using Update query

Update TblStudent SET First_Name='Sandeep' , Last_Name='Kumawat', Age=24, ContactNo=258963
where ID=102

Output

After update query , make select query on TblStudent.

ID First_Name Last_Name Father_Name Age Address ContactNo
101 Jai Soni Dinesh Soni 23 jaipur, ram nagar b-007,h-786 4586859
102 Sandeep Kumawat Sivaji tak 24 delhi, rai nagar b-07,h-76 258963
103 Ramesh jain Surajprakash jain 23 ajmer, suraj nagar b-258,h-746 1234568
104 Rahul Tanvar Dhyanchand tanvar 25 ajmer, ram nagar b-278,h-366 65489645
105 Aameer Khan aasif khan 45 mumbai, aajad nagar 1232584



Related Videos