UPDATE Command With Multiple Records
Example: Updating the ‘courseCost’ of all the courses with a discount of 10% in the ‘CoursesActive’ table.
Query
UPDATE CoursesActive
SET courseCost = ROUND(courseCost * 0.9,2);
SELECT * FROM CoursesActive
Output:
Explanation: In the above Query, We have applied the discount of 10% across all the courseCost of the CourseActive table. The new courseCost
values are calculated by multiplying the existing courseCost
values by 0.9 (reducing them to 90% of their current values) and then rounding the result to two decimal places using the ROUND
function.
SQL Server UPDATE
SQL Server is a database engine. It works on the relational database management system (RDBMS) that allow programmer to create, manage, and manipulate data present on the relational database through their commands which is easy to learn and implement.