03/05/2024 | 08:23
Điều kiện vay vốn JICA
Certainly! You can use the following SQL query to add a "status" column to an existing "orders" table and set it to "PENDING" by default. If the "completed_at" column is set, then the "status" will be set to "COMPLETE":
```sql
ALTER TABLE orders
ADD COLUMN status VARCHAR(10) DEFAULT 'PENDING';
UPDATE orders
SET status = 'COMPLETE'
WHERE completed_at IS NOT NULL;
```
This assumes that your "orders" table already exists, and you are altering it to add the "status" column. Adjust the data types and column names according to your actual table structure.
4.9/5 (60 votes)
Có thể bạn quan tâm:
Website