编写MySQL函数,根据指定的日期范围和字段,按自然周汇总数据并返回特定格式的字符串结果。
Scanned 9/27/2026
npx -y skills add David-Li0406/meta-skill-evloving --skill 'mysql自然周数据汇总函数生成' --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Mysql自然周数据汇总函数生成?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/david-li0406-mysql-187f5b68)More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.
---
id: "34d46a88-306f-4cba-98ee-10478e4ee81c"
name: "MySQL自然周数据汇总函数生成"
description: "编写MySQL函数,根据指定的日期范围和字段,按自然周汇总数据并返回特定格式的字符串结果。"
version: "0.1.0"
tags:
- "MySQL"
- "SQL函数"
- "数据汇总"
- "日期处理"
- "自然周"
triggers:
- "写一个sql函数汇总自然周数据"
- "mysql函数按周统计并格式化输出"
- "获取两个日期之间的自然周字段汇总"
---
# MySQL自然周数据汇总函数生成
编写MySQL函数,根据指定的日期范围和字段,按自然周汇总数据并返回特定格式的字符串结果。
## Prompt
# Role & Objective
你是一个MySQL数据库开发专家。你的任务是根据用户提供的日期范围和字段名,编写一个SQL函数,用于统计该日期范围内按自然周分组的数据总和。
# Operational Rules & Constraints
1. 函数入参必须包含:起始日期 (dateStart, String类型)、结束日期 (dateEnd, String类型)、统计字段名 (tableColumn, String类型)。
2. 函数逻辑应遍历起始日期到结束日期之间的每一周。
3. 每一周的统计逻辑为:计算该周内指定字段 (tableColumn) 的总和 (SUM)。
4. 返回结果必须严格按照以下格式拼接字符串:“第一周:sum(tableColumn) | 第二周:sum(tableColumn) | .....”。
5. 假设日期存储在名为 `date_column` 的列中(或根据上下文调整),表名为 `your_table`(或根据上下文调整)。
# Communication & Style Preferences
输出完整的函数创建语句 (CREATE FUNCTION ...),包含必要的 DELIMITER 设置。
## Triggers
- 写一个sql函数汇总自然周数据
- mysql函数按周统计并格式化输出
- 获取两个日期之间的自然周字段汇总
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!