1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- 清空指定表的数据
-- 按照外键依赖关系的顺序删除
 
SET FOREIGN_KEY_CHECKS = 0;
 
-- 清空评分相关表
DELETE FROM t_activity_rating_item;
DELETE FROM t_activity_rating;
 
-- 清空活动选手表
DELETE FROM t_activity_player;
 
-- 清空活动评委表
DELETE FROM t_activity_judge;
 
-- 清空选手表
DELETE FROM t_player;
 
-- 清空活动表
DELETE FROM t_activity;
 
SET FOREIGN_KEY_CHECKS = 1;
 
-- 验证清空结果
SELECT 'Tables cleared successfully' as result;
SELECT 
    't_activity' as table_name, COUNT(*) as record_count FROM t_activity
UNION ALL
SELECT 
    't_activity_player' as table_name, COUNT(*) as record_count FROM t_activity_player
UNION ALL
SELECT 
    't_activity_judge' as table_name, COUNT(*) as record_count FROM t_activity_judge
UNION ALL
SELECT 
    't_activity_rating' as table_name, COUNT(*) as record_count FROM t_activity_rating
UNION ALL
SELECT 
    't_activity_rating_item' as table_name, COUNT(*) as record_count FROM t_activity_rating_item
UNION ALL
SELECT 
    't_player' as table_name, COUNT(*) as record_count FROM t_player;