beginР?SET?@should_pay_new?=@should_pay_oldР?SET?@real_pay_new?=@real_pay_old-@sal_prom_payРendРelseРbeginР?SET?@should_pay_new?=@should_pay_oldР?SET?@real_pay_new?=@real_pay_oldРendРUPDATE?TEA_SAL SET?SHOULD_PAY=@SHOULD_PAY_NEW,REAL_PAY=@REAL_PAY_NEW WHERE?TEA_ID=@TEA_ID_OLDР视图脚本:创建视图查询各个员工的应发、应扣和实发工资Рcreate view view_teacher_payРasРSELECT teacher.tea_id,tea_name,should_pay,real_pay,should_discountР from teacher,tea_sal where teacher.tea_id=tea_sal.tea_idР建立数据库相关表之间的参照完整性约束Рcheck_flag_setРalter table sal_prom with checkРadd?constraint check_flag_set check(sal_prom_flag_set='已启用' OR sal_prom_flag_set='未启用')Рcheck_flag_addРalter table?sal_prom with checkРadd constraint check_flag_add check(sal_prom_flag_add='加' or sal_prom_flag_add='扣')Р8.数据库恢复与备份:Р数据库的完全备份Р备份РUSE PayРGOРbackup database Pay