+ 3

Update a row in SQL

i wanna know how to decrease a column value while satisfiying a condition

17th Jun 2019, 7:09 PM
JASON
JASON - avatar
3 Answers
+ 6
UPDATE table_name SET column1 = value1, column2 = value2...., columnN = valueN WHERE [condition]; https://www.tutorialspoint.com/sql/sql-update-query.htm Update is done with update command satisfying a condition is done with where command Decrease a value, substract 1 UPDATE Orders SET Quantity = Quantity - 1 WHERE ... Try the commands and see what happens.
17th Jun 2019, 7:21 PM
sneeze
sneeze - avatar
+ 2
okay thanks
17th Jun 2019, 7:23 PM
JASON
JASON - avatar
0
update tablename set columnname=existingvalue-value to be reduced [ where condition];
18th Jun 2019, 9:00 AM
sree harsha
sree harsha - avatar