场景:借还款统计数据,一笔贷款可以对应多笔还款。
贷款表
DROP TABLE IF EXISTS `load_contract`;
CREATE TABLE `load_contract` (
`load_id` bigint(0) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '贷款ID',
`load_amt` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '贷款金额',
`persion` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '贷款人',
PRIMARY KEY (`load_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of load_contract
-- ----------------------------
INSERT INTO `load_contract` VALUES (5, 50.00, 'zzl');
INSERT INTO `load_contract` VALUES (8, 60.00, 'zzl');
INSERT INTO `load_contract` VALUES (10, 20.00, 'zzy');
还款表
DROP TABLE