mysql将大表定时转储_mysql数据库数据定时封装转储
1.封裝轉儲存儲過程
CREATE ?PROCEDURE `add_resident_portrait`()
BEGIN
TRUNCATE TABLE resident_portrait;
INSERT INTO resident_portrait (
vehicleNumber,
parkid,
vehicleType,
vehicleBrand,
vehiclePhoto,
vehicleColor,
vehicleResidentFlag,
estate_address,
building_code,
unit_code,
floor,
areasize,
house_number,
estate_type,
delivery_time,
checkin_time,
rent_flag,
volResource,
volIntro,
checkStatus,
volunteerType,
signTime,
nation,
marr_status,
edu_status,
belief,
height,
weight,
resaddr,
restype,
healths,
volunid,
mail,
wechat,
huimg_url,
blood,
resimg_url,
workplace,
profession,
address,
phone_num,
mobnum,
political,
photo_url,
street,
cu,
area,
pro,
build,
NAME,
sex,
birthday,
idcard,
fatherid,
motherid
) SELECT
#車牌號
vehicleinfo.vehicleNumber,
#停車場編號
vehicleinfo.parkid,
#車輛類型
vehicleinfo.vehicleType,
#車輛品牌
vehicleinfo.vehicleBrand,
#車輛照片
vehicleinfo.vehiclePhoto,
#車輛顏色
vehicleinfo.vehicleColor,
#車輛業主屬性
vehicleinfo.vehicleResidentFlag,
#房產地址
pr_estate_info.estate_address,
#樓號
pr_estate_info.building_code,
#單元號
pr_estate_info.unit_code,
#樓層
pr_estate_info.floor,
#面積
pr_estate_info.area,
#門牌號
pr_estate_info.house_number,
#房產類型
pr_estate_info.estate_type,
#交房時間
pr_estate_info.delivery_time,
#入住時間
pr_estate_info.checkin_time,
#是否出租
pr_estate_info.rent_flag,
#志愿者資質
volunteerinfo.volResource,
#志愿者可提供服務簡介
volunteerinfo.volIntro,
#志愿者審核狀態
volunteerinfo.checkStatus,
#志愿者類型
volunteerinfo.volunteerType,
#志愿者注冊時間
volunteerinfo.signTime,
#民族
cu_resinfo.nation,
#婚姻狀態
cu_resinfo.marr_status,
#教育情況
cu_resinfo.edu_status,
#宗教信仰
cu_resinfo.belief,
#身高
cu_resinfo.height,
#體重
cu_resinfo.weight,
#戶籍地址
cu_resinfo.resaddr,
#戶籍類型
cu_resinfo.restype,
#健康情況
cu_resinfo.healths,
#志愿者id
cu_resinfo.volunid,
#郵箱
cu_resinfo.mail,
#微信
cu_resinfo.wechat,
#房產證照片地址
cu_resinfo.huimg_url,
#血型
cu_resinfo.blood,
#戶口本照片地址
cu_resinfo.resimg_url,
#工作單位
cu_resinfo.workplace,
#職業
cu_resinfo.profession,
#地址
cu_resinfo.address,
#固定電話
cu_resinfo.phone_num,
#手機
cu_resinfo.mobnum,
#政治面貌
cu_resinfo.political,
#照片地址
cu_resinfo.photo_url,
#所屬街道
cu_resinfo.street,
#所屬社區
cu_resinfo.cu,
#所屬小區
cu_resinfo.area,
#所屬物業
cu_resinfo.pro,
#所屬樓宇
cu_resinfo.build,
#姓名
cu_resinfo. NAME,
#性別
cu_resinfo.sex,
#生日
cu_resinfo.birthday,
#身份證號
cu_resinfo.idcard,
#父親id
cu_resinfo.fatherid,
#母親id
cu_resinfo.motherid
FROM
cu_resinfo,
pr_estate_info,
vehicleinfo,
volunteerinfo
WHERE
cu_resinfo.id = vehicleinfo.staffid
AND cu_resinfo.id = pr_estate_info.staffid
AND cu_resinfo.volunid = volunteerinfo.id;
END
2.定時執行任務
CREATE EVENT
dump_resident_portrait
ON SCHEDULE EVERY 7 DAY
STARTS '2018-09-02 00:00:00' DO
CALL add_resident_portrait;
總結
以上是生活随笔為你收集整理的mysql将大表定时转储_mysql数据库数据定时封装转储的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 下载MySQL并创建桌面数据库_sql桌
- 下一篇: Mysql价格降低20%应该怎么写_my