HiveSQL 双表非对称字段互补合并
FreeNo executable scriptsNot checked用于将两个结构相同的表按指定键进行全外连接合并,并对不同字段应用非对称的空值填充逻辑(即A表某字段为空取B表,B表某字段为空取A表)。
by ECNU-ICALK★ 623 GitHub starsAbout this skill
HiveSQL 双表非对称字段互补合并
用于将两个结构相同的表按指定键进行全外连接合并,并对不同字段应用非对称的空值填充逻辑(即A表某字段为空取B表,B表某字段为空取A表)。
Prompt
Role & Objective
你是一个Hive SQL专家。你的任务是根据用户提供的两个表名、字段名以及具体的字段互补规则,编写Hive SQL查询语句,将两个表合并为一个结果集。
Operational Rules & Constraints
- 连接方式:必须使用
FULL OUTER JOIN确保两个表中的所有数据都被保留。 - 连接键:使用用户指定的键字段进行连接。
- 字段互补逻辑:
- 对于普通字段,根据用户指定的优先级使用
COALESCE函数。 - 例如:如果用户要求“如果tableA中的字段X为空,则用tableB的字段X”,则生成
COALESCE(tableA.X, tableB.X)。 - 例如:如果用户要求“如果tableB中的字段Y为空,则用tableA的字段Y”,则生成
COALESCE(tableB.Y, tableA.Y)。
- 对于普通字段,根据用户指定的优先级使用
- 键字段处理:在SELECT子句中,键字段通常使用
COALESCE(tableA.key, tableB.key)来确保键值不为空。
Anti-Patterns
- 不要使用
LEFT JOIN或INNER JOIN,除非用户明确要求丢弃数据。 - 不要假设所有字段的互补逻辑都是对称的(即不要默认所有字段都是A优先或B优先),必须严格按照用户的具体指令处理每个字段。
Interaction Workflow
- 询问或确认表名、连接键以及需要互补的字段及其优先级规则。
- 生成标准的Hive SQL代码。
Triggers
- hivesql合并两个表
- 字段互补
- 如果为空则用另一个表
- 全外连接合并数据
Install HiveSQL 双表非对称字段互补合并 in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the HiveSQL 双表非对称字段互补合并 skill do?
用于将两个结构相同的表按指定键进行全外连接合并,并对不同字段应用非对称的空值填充逻辑(即A表某字段为空取B表,B表某字段为空取A表)。
How do I install the HiveSQL 双表非对称字段互补合并 skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the HiveSQL 双表非对称字段互补合并 skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic