设计(一)数据库数据清理

## 1
# 去掉 housedetails 表中字段 deal_time 的日期
# SET SQL_SAFE_UPDATES = 0;
# update secondary.housedetails set deal_time = LEFT(deal_time,7) where id IS NOT NULL;
# SET SQL_SAFE_UPDATES = 1;
# SELECT * FROM secondary.housedetails;

## 2 

# 去掉 through_nums 字段中值为“暂无数据”的记录
# SET SQL_SAFE_UPDATES = 0;
# DELETE FROM secondary.housedetails WHERE through_nums = "暂无数据";
# ALTER TABLE secondary.housedetails MODIFY through_nums int(30) DEFAULT NULL;
# SET SQL_SAFE_UPDATES = 1;

## 3 

# 修改 area 字段的格式,由 varchar 到 double 
# SET SQL_SAFE_UPDATES = 0;
# ALTER TABLE secondary.housedetails MODIFY area double DEFAULT NULL;
# SET SQL_SAFE_UPDATES = 1;

## 4 

# 删除 within_area 字段
# alter table secondary.housedetails drop column within_area ;

 

posted @ 2021-04-08 20:25  天宇爱水  阅读(75)  评论(0编辑  收藏  举报