Home > Enterprise >  MYSQL how to update the ship amount for the order dates after 2015-03-30 15:22:31 to 15
MYSQL how to update the ship amount for the order dates after 2015-03-30 15:22:31 to 15

Time:02-12

I'm having trouble with this question: Write an UPDATE statement that modifies the Orders table. Change all ship amount for order dates after 2015-03-30 15:22:31 to 15. If you get an error due to safe-update mode, you can add a LIMIT clause to update the first 100 rows of the table. (This should update all rows in the table.)

I've written it like this:

UPDATE orders
SET ship_amount = 15
WHERE order_date = 2015-03-30 15:22:31
LIMIT 100;

but I'm getting an error in the where clause and I'm using the my_guitar_shop schema

CodePudding user response:

The date value 2015-03-30 15:22:31 should written under '' single cotes.

UPDATE order_details SET add_by_admin = 15 WHERE created_at > '2022-02-09 18:44:01' LIMIT 100

eg.

UPDATE orders
SET ship_amount = 15
WHERE order_date > '2015-03-30 15:22:31'
LIMIT 100;
  • Related