### 试题 ![数据库题目 (1)](https://yp.smallkun.cn/markdown/%E6%95%B0%E6%8D%AE%E5%BA%93%E9%A2%98%E7%9B%AE%20(1).png!compress) ![数据库题目 (2)](https://yp.smallkun.cn/markdown/%E6%95%B0%E6%8D%AE%E5%BA%93%E9%A2%98%E7%9B%AE%20(2).png!compress) ![数据库题目 (3)](https://yp.smallkun.cn/markdown/%E6%95%B0%E6%8D%AE%E5%BA%93%E9%A2%98%E7%9B%AE%20(3).png!compress) ### 表结构素材 ```sql /* Navicat MySQL Data Transfer Source Server : localhost_3306_1 Source Server Type : MySQL Source Server Version : 50743 (5.7.43-log) Source Host : localhost:3306 Source Schema : db_sports_meet Target Server Type : MySQL Target Server Version : 50743 (5.7.43-log) File Encoding : 65001 Date: 18/03/2025 15:24:40 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for t_athletes -- ---------------------------- DROP TABLE IF EXISTS `t_athletes`; CREATE TABLE `t_athletes` ( `id` int(6) NOT NULL AUTO_INCREMENT, `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `sex` enum('男','女') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `birthday` date NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 10051 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of t_athletes -- ---------------------------- INSERT INTO `t_athletes` VALUES (10001, '余璐', '女', '2001-03-03'); INSERT INTO `t_athletes` VALUES (10002, '向岚', '女', '2000-12-02'); INSERT INTO `t_athletes` VALUES (10003, '郭子韬', '男', '2001-09-17'); INSERT INTO `t_athletes` VALUES (10004, '郝致远', '男', '2000-01-21'); INSERT INTO `t_athletes` VALUES (10005, '史嘉伦', '男', '2000-05-03'); INSERT INTO `t_athletes` VALUES (10006, '高致远', '男', '2002-09-17'); INSERT INTO `t_athletes` VALUES (10007, '史岚', '女', '2001-01-12'); INSERT INTO `t_athletes` VALUES (10008, '邹震南', '男', '2001-12-05'); INSERT INTO `t_athletes` VALUES (10009, '向子异', '男', '1999-09-09'); INSERT INTO `t_athletes` VALUES (10010, '范子异', '男', '2001-09-05'); INSERT INTO `t_athletes` VALUES (10011, '余云熙', '男', '2002-05-26'); INSERT INTO `t_athletes` VALUES (10012, '徐璐', '女', '2001-03-26'); INSERT INTO `t_athletes` VALUES (10013, '方宇宁', '男', '1999-04-18'); INSERT INTO `t_athletes` VALUES (10014, '萧詩涵', '女', '2001-04-09'); INSERT INTO `t_athletes` VALUES (10015, '向致远', '男', '1999-02-14'); INSERT INTO `t_athletes` VALUES (10016, '向岚', '女', '1999-07-31'); INSERT INTO `t_athletes` VALUES (10017, '方安琪', '女', '2000-01-16'); INSERT INTO `t_athletes` VALUES (10018, '刘晓明', '男', '2001-01-17'); INSERT INTO `t_athletes` VALUES (10019, '顾震南', '男', '2000-07-16'); INSERT INTO `t_athletes` VALUES (10020, '汤嘉伦', '男', '2001-12-25'); INSERT INTO `t_athletes` VALUES (10021, '龙睿', '男', '2000-02-14'); INSERT INTO `t_athletes` VALUES (10022, '顾睿', '男', '2001-10-25'); INSERT INTO `t_athletes` VALUES (10023, '卢秀英', '女', '2002-02-24'); INSERT INTO `t_athletes` VALUES (10024, '汪詩涵', '女', '2001-11-27'); INSERT INTO `t_athletes` VALUES (10025, '丁杰宏', '男', '1999-10-05'); INSERT INTO `t_athletes` VALUES (10026, '任安琪', '女', '1999-03-25'); INSERT INTO `t_athletes` VALUES (10027, '沈云熙', '男', '2000-03-21'); INSERT INTO `t_athletes` VALUES (10028, '邵詩涵', '女', '1999-04-04'); INSERT INTO `t_athletes` VALUES (10029, '袁云熙', '男', '2000-04-08'); INSERT INTO `t_athletes` VALUES (10030, '张睿', '男', '1999-12-16'); INSERT INTO `t_athletes` VALUES (10031, '徐杰宏', '男', '2002-01-16'); INSERT INTO `t_athletes` VALUES (10032, '郑云熙', '男', '2002-06-06'); INSERT INTO `t_athletes` VALUES (10033, '梁秀英', '女', '2002-10-27'); INSERT INTO `t_athletes` VALUES (10034, '向晓明', '男', '2002-08-21'); INSERT INTO `t_athletes` VALUES (10035, '江詩涵', '女', '2000-12-16'); INSERT INTO `t_athletes` VALUES (10036, '夏岚', '女', '2002-02-14'); INSERT INTO `t_athletes` VALUES (10037, '程晓明', '男', '2001-09-07'); INSERT INTO `t_athletes` VALUES (10038, '邱云熙', '男', '1999-02-24'); INSERT INTO `t_athletes` VALUES (10039, '曾子韬', '男', '2002-07-07'); INSERT INTO `t_athletes` VALUES (10040, '朱嘉伦', '男', '2000-02-10'); INSERT INTO `t_athletes` VALUES (10041, '魏岚', '女', '2000-02-06'); INSERT INTO `t_athletes` VALUES (10042, '袁云熙', '男', '2000-07-04'); INSERT INTO `t_athletes` VALUES (10043, '田云熙', '男', '2002-12-18'); INSERT INTO `t_athletes` VALUES (10044, '秦嘉伦', '男', '2001-10-29'); INSERT INTO `t_athletes` VALUES (10045, '金秀英', '女', '2001-08-05'); INSERT INTO `t_athletes` VALUES (10046, '高宇宁', '男', '2002-09-24'); INSERT INTO `t_athletes` VALUES (10047, '周宇宁', '男', '2001-10-10'); INSERT INTO `t_athletes` VALUES (10048, '王璐', '女', '2000-09-07'); INSERT INTO `t_athletes` VALUES (10049, '徐致远', '男', '1999-06-09'); INSERT INTO `t_athletes` VALUES (10050, '何云熙', '男', '2001-02-06'); -- ---------------------------- -- Table structure for t_match -- ---------------------------- DROP TABLE IF EXISTS `t_match`; CREATE TABLE `t_match` ( `id` int(6) NOT NULL AUTO_INCREMENT, `sid` int(6) NULL DEFAULT NULL, `aid` int(6) NULL DEFAULT NULL, `grade` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 10101 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of t_match -- ---------------------------- INSERT INTO `t_match` VALUES (10001, 10008, 10014, '第一名'); INSERT INTO `t_match` VALUES (10002, 10003, 10004, '第一名'); INSERT INTO `t_match` VALUES (10003, 10005, 10042, '第二名'); INSERT INTO `t_match` VALUES (10004, 10006, 10037, '第一名'); INSERT INTO `t_match` VALUES (10005, 10003, 10040, '第二名'); INSERT INTO `t_match` VALUES (10006, 10006, 10047, '第十名'); INSERT INTO `t_match` VALUES (10007, 10001, 10002, '第一名'); INSERT INTO `t_match` VALUES (10008, 10006, 10005, '第三名'); INSERT INTO `t_match` VALUES (10009, 10008, 10033, '第六名'); INSERT INTO `t_match` VALUES (10010, 10002, 10026, '第一名'); INSERT INTO `t_match` VALUES (10011, 10006, 10043, '第八名'); INSERT INTO `t_match` VALUES (10012, 10008, 10016, '第七名'); INSERT INTO `t_match` VALUES (10013, 10007, 10017, '第二名'); INSERT INTO `t_match` VALUES (10014, 10002, 10001, '第十一名'); INSERT INTO `t_match` VALUES (10015, 10004, 10006, '第十二名'); INSERT INTO `t_match` VALUES (10016, 10006, 10045, '第七名'); INSERT INTO `t_match` VALUES (10017, 10004, 10013, '第三名'); INSERT INTO `t_match` VALUES (10018, 10008, 10024, '第九名'); INSERT INTO `t_match` VALUES (10019, 10004, 10022, '第四名'); INSERT INTO `t_match` VALUES (10020, 10003, 10046, '第六名'); INSERT INTO `t_match` VALUES (10021, 10008, 10018, '第二名'); INSERT INTO `t_match` VALUES (10022, 10009, 10027, '第九名'); INSERT INTO `t_match` VALUES (10023, 10008, 10030, '第四名'); INSERT INTO `t_match` VALUES (10024, 10004, 10019, '第七名'); INSERT INTO `t_match` VALUES (10025, 10008, 10023, '第八名'); INSERT INTO `t_match` VALUES (10026, 10005, 10041, '第六名'); INSERT INTO `t_match` VALUES (10027, 10009, 10009, '第六名'); INSERT INTO `t_match` VALUES (10028, 10006, 10007, '第六名'); INSERT INTO `t_match` VALUES (10029, 10002, 10050, '第六名'); INSERT INTO `t_match` VALUES (10030, 10004, 10020, '第九名'); INSERT INTO `t_match` VALUES (10031, 10001, 10039, '第十二名'); INSERT INTO `t_match` VALUES (10032, 10008, 10028, '第五名'); INSERT INTO `t_match` VALUES (10033, 10001, 10034, '第七名'); INSERT INTO `t_match` VALUES (10034, 10003, 10015, '第九名'); INSERT INTO `t_match` VALUES (10035, 10002, 10021, '第九名'); INSERT INTO `t_match` VALUES (10036, 10001, 10011, '第二名'); INSERT INTO `t_match` VALUES (10037, 10008, 10010, '第三名'); INSERT INTO `t_match` VALUES (10038, 10006, 10049, '第十一名'); INSERT INTO `t_match` VALUES (10039, 10003, 10031, '第八名'); INSERT INTO `t_match` VALUES (10040, 10007, 10048, '第九名'); INSERT INTO `t_match` VALUES (10041, 10001, 10038, '第十名'); INSERT INTO `t_match` VALUES (10042, 10003, 10036, '第四名'); INSERT INTO `t_match` VALUES (10043, 10009, 10012, '第二名'); INSERT INTO `t_match` VALUES (10044, 10007, 10003, '第一名'); INSERT INTO `t_match` VALUES (10045, 10006, 10044, '第二名'); INSERT INTO `t_match` VALUES (10046, 10005, 10025, '第七名'); INSERT INTO `t_match` VALUES (10047, 10009, 10035, '第十名'); INSERT INTO `t_match` VALUES (10048, 10002, 10008, '第十二名'); INSERT INTO `t_match` VALUES (10049, 10005, 10032, '第八名'); INSERT INTO `t_match` VALUES (10050, 10009, 10029, '第七名'); INSERT INTO `t_match` VALUES (10051, 10004, 10043, '第五名'); INSERT INTO `t_match` VALUES (10052, 10009, 10031, '第三名'); INSERT INTO `t_match` VALUES (10053, 10005, 10029, '第十名'); INSERT INTO `t_match` VALUES (10054, 10006, 10042, '第十二名'); INSERT INTO `t_match` VALUES (10055, 10001, 10012, '第三名'); INSERT INTO `t_match` VALUES (10056, 10007, 10012, '第十名'); INSERT INTO `t_match` VALUES (10057, 10005, 10026, '第十一名'); INSERT INTO `t_match` VALUES (10058, 10003, 10007, '第七名'); INSERT INTO `t_match` VALUES (10059, 10002, 10034, '第二名'); INSERT INTO `t_match` VALUES (10060, 10005, 10005, '第十二名'); INSERT INTO `t_match` VALUES (10061, 10007, 10001, '第七名'); INSERT INTO `t_match` VALUES (10062, 10005, 10038, '第一名'); INSERT INTO `t_match` VALUES (10063, 10007, 10046, '第八名'); INSERT INTO `t_match` VALUES (10064, 10002, 10024, '第十名'); INSERT INTO `t_match` VALUES (10065, 10007, 10049, '第六名'); INSERT INTO `t_match` VALUES (10066, 10005, 10030, '第三名'); INSERT INTO `t_match` VALUES (10067, 10004, 10023, '第一名'); INSERT INTO `t_match` VALUES (10068, 10007, 10044, '第五名'); INSERT INTO `t_match` VALUES (10069, 10001, 10050, '第八名'); INSERT INTO `t_match` VALUES (10070, 10002, 10006, '第七名'); INSERT INTO `t_match` VALUES (10071, 10007, 10014, '第四名'); INSERT INTO `t_match` VALUES (10072, 10002, 10013, '第五名'); INSERT INTO `t_match` VALUES (10073, 10001, 10046, '第十一名'); INSERT INTO `t_match` VALUES (10074, 10003, 10029, '第三名'); INSERT INTO `t_match` VALUES (10075, 10004, 10038, '第二名'); INSERT INTO `t_match` VALUES (10076, 10009, 10008, '第十一名'); INSERT INTO `t_match` VALUES (10077, 10009, 10037, '第五名'); INSERT INTO `t_match` VALUES (10078, 10001, 10006, '第五名'); INSERT INTO `t_match` VALUES (10079, 10009, 10021, '第八名'); INSERT INTO `t_match` VALUES (10080, 10003, 10016, '第五名'); INSERT INTO `t_match` VALUES (10081, 10004, 10025, '第八名'); INSERT INTO `t_match` VALUES (10082, 10001, 10021, '第四名'); INSERT INTO `t_match` VALUES (10083, 10003, 10028, '第十名'); INSERT INTO `t_match` VALUES (10084, 10002, 10003, '第三名'); INSERT INTO `t_match` VALUES (10085, 10002, 10039, '第四名'); INSERT INTO `t_match` VALUES (10086, 10001, 10047, '第六名'); INSERT INTO `t_match` VALUES (10087, 10009, 10033, '第一名'); INSERT INTO `t_match` VALUES (10088, 10004, 10041, '第六名'); INSERT INTO `t_match` VALUES (10089, 10006, 10013, '第九名'); INSERT INTO `t_match` VALUES (10090, 10006, 10004, '第四名'); INSERT INTO `t_match` VALUES (10091, 10002, 10047, '第八名'); INSERT INTO `t_match` VALUES (10092, 10006, 10027, '第五名'); INSERT INTO `t_match` VALUES (10093, 10001, 10018, '第九名'); INSERT INTO `t_match` VALUES (10094, 10007, 10050, '第三名'); INSERT INTO `t_match` VALUES (10095, 10005, 10020, '第四名'); INSERT INTO `t_match` VALUES (10096, 10004, 10007, '第十一名'); INSERT INTO `t_match` VALUES (10097, 10004, 10031, '第十名'); INSERT INTO `t_match` VALUES (10098, 10005, 10033, '第五名'); INSERT INTO `t_match` VALUES (10099, 10009, 10024, '第四名'); INSERT INTO `t_match` VALUES (10100, 10005, 10049, '第九名'); -- ---------------------------- -- Table structure for t_sport -- ---------------------------- DROP TABLE IF EXISTS `t_sport`; CREATE TABLE `t_sport` ( `id` int(6) NOT NULL AUTO_INCREMENT, `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `time` datetime NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 10010 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of t_sport -- ---------------------------- INSERT INTO `t_sport` VALUES (10001, '100米跑步', '2023-10-17 09:30:00'); INSERT INTO `t_sport` VALUES (10002, '200米跑步', '2023-10-18 09:30:00'); INSERT INTO `t_sport` VALUES (10003, '800米跑步', '2023-10-17 14:30:00'); INSERT INTO `t_sport` VALUES (10004, '3000米跑步', '2023-10-18 14:30:00'); INSERT INTO `t_sport` VALUES (10005, '跳高', '2023-10-17 10:30:00'); INSERT INTO `t_sport` VALUES (10006, '跳远', '2023-10-17 11:30:00'); INSERT INTO `t_sport` VALUES (10007, '铅球', '2023-10-17 15:30:00'); INSERT INTO `t_sport` VALUES (10008, '110米栏', '2023-10-17 16:30:00'); INSERT INTO `t_sport` VALUES (10009, '跳绳', '2023-10-18 10:30:00'); SET FOREIGN_KEY_CHECKS = 1; ``` ### 触发器素材 ```sql CREATE 【 】 assign_judge 【 】 【 】 ON t_sport FOR EACH ROW BEGIN 【 】 【 】 t_judge (id, name, tel, sid) VALUES (1001, '周周', '语文', 【 】); END ``` ### 存储过程素材 ```sql CREATE 【 】 `athlete_grade`(IN 【 】 INT, IN 【 】 INT, 【 】 out_grade VARCHAR(200)) BEGIN SELECT m.grade 【 】 out_grade FROM t_match m WHERE m.aid = 【 】 AND m.sid = 【 】; END ```