Hướng dẫn sử dụng Xinmeng X98

Sure, here's a SQL query to achieve that:

```sql

ALTER TABLE orders

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

UPDATE orders

SET status = 'COMPLETE'

WHERE completed_at IS NOT NULL;

```

This query first alters the table `orders` to add a new column called `status` with a default value of 'PENDING'. Then, it updates the `status` column to 'COMPLETE' for rows where the `completed_at` column is not null, indicating that the order has been completed.

4.8/5 (23 votes)


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