27/04/2024 | 17:01
Thủ tục vay ngân hàng nông nghiệp và phát triển nông thôn
Sure, here's a SQL query to achieve that:
```sql
ALTER TABLE orders
ADD COLUMN status VARCHAR(50) DEFAULT 'PENDING';
UPDATE orders
SET status = 'COMPLETE'
WHERE completed_at IS NOT NULL;
```
This SQL script first adds a new column called "status" to the "orders" table with a default value of 'PENDING'. Then, it updates the "status" column to 'COMPLETE' for all orders where the "completed_at" column is not null, effectively setting the status to 'COMPLETE' for completed orders.
4.9/5 (53 votes)
Website