Kẹo bùa yêu có tác dụng gì

Certainly! Assuming you have an "orders" table, you can use the following SQL query to add a "status" column with a default value of 'PENDING' and update it to 'COMPLETE' if the "completed_at" column is set:

```sql

-- Add the "status" column with default value 'PENDING'

ALTER TABLE orders

ADD COLUMN status VARCHAR(255) DEFAULT 'PENDING';

-- Update "status" to 'COMPLETE' where "completed_at" is set

UPDATE orders

SET status = 'COMPLETE'

WHERE completed_at IS NOT NULL;

```

This assumes that the "status" column is of type VARCHAR(255), but you can adjust the data type based on your specific requirements.

4.8/5 (50 votes)

Lazada logo
Logo LelExpress
Logo Visa
Shopee Logo
Ahamove Logo
GHN logo
Lazada Logo