1. 计算新客留存率用到的字段信息有:用户ID,用户登录日期;创建一张只有用户ID和用户登录日期的表:CREATE TABLE IF NOT EXISTS user_log('id' int(11) NOT NULL AUTO_INCREMENT,'operator_id' STRING COMMENT '登录用户ID','create_time' DATETIME COMMENT '创建时间'PRIMARY KEY (`id`) USING BTREE)...
`code` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `idx_uni_name`(`name`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; INSERT INTO `t_...
PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 1. 2. 3. 4. 5. 6. 在READ UNCOMMITTED级别下会出现脏读 首先设置当前会话的隔离级别为READ UNCOMMITTED set session transaction isolation level read uncommitted; 1. 这里可...
PRIMARY KEY (`id`) USING BTREE, KEY `idx_business_day_full_ps_code` (`business_day`,`full_ps_code`) ===以下索引可以忽略=== KEY `idx_erp_month_businessday` (`erp`,`month`,`business_day`), KEY `idx_business_day_erp` (`business_day`,`erp`), KEY `idx_erp_month_ps_plan_id`...
PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠卷表' ROW_FORMAT = Compact; INSERT INTO `tb_coupon` VALUES (1, 'uuu', '1', 0, 0, 100, '', 2, '1000-01-01 00:00:00', '1000-01-01 00...
PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=65DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='单聊 聊天记录';--插入数据的sql INSERT INTO `commun_message_chat_single` VALUES (60,10,'11','md_1','123',1,'2019-10-16 08:25:50'); ...
PRIMARYKEY(`id`)USINGBTREE, KEY`idx_userid_createtime`(`user_id`,`create_time`)USINGBTREE ) 今天是 2023-09-12 ,如果我们要统计近 1 天的订单量,那么 SQL 很简单: SELECT count(*) FROM order where user_id = 'xx' and time_create >'2023-09-12 00:00:00' ...
PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; INSERT INTO `t_user` VALUES (1, 'caicai'); INSERT INTO `t_user` VALUES (2, '菜菜'); CREATE TABLE `t_user_role` ( ...
创建一张只有用户ID和用户登录日期的表: CREATE TABLE IF NOT EXISTS user_log ( 'id' int(11) NOT NULL AUTO_INCREMENT, 'operator_id' STRING COMMENT '登录用户ID', 'create_time' DATETIME COMMENT '创建时间' PRIMARY KEY (`id`) USING BTREE ) COMMENT '用户登录表' 2.计算过程: 为便于理解,下面...