filmov
tv
SQL UPDATE query to update columns with WHERE & AND conditions & with multiple columns data

Показать описание
We can update all rows by using update and set command. Updating any single record can be done by using where condition with Id
UPDATE student set mark=mark+5 WHERE id =7
We can update all the rows by not using any restriction or WHERE condition
UPDATE student set mark=0
We can use AND along with WHERE condition to add more restrictions.
UPDATE student SET mark= mark+5 WHERE class=’Four’ and mark=70
Above query will update class for all students where class is four and mark value is more than or equal to 70.