UPDATE Statement in SQL
Level 4105 keystrokes
UPDATE changes existing rows; here it gives in-stock Electronics a 10% discount.
SQL code
-- Change rows of the products table1UPDATE2 products3SET -- Multiply the current price by 0.9, a 10% discount4 price = price * 0.9, -- Record when the row was changed5 updated_at = NOW()-- Only Electronics with stock; without WHERE, every row would be updated6WHERE7 category = 'Electronics'8 AND stock > 0;Output
Query OK, 15 rows affected Rows matched: 15 Changed: 15 Warnings: 0
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this SQL code and how often they appear.
=× 3'× 2_× 1,× 1;× 1.× 1(× 1)× 1*× 1>× 1