本提示词模板专门用于将SQL数据定义语言(DDL)语句转换为结构化的JSON格式,帮助用户轻松解析和理解数据库架构定义。该工具具备智能语法识别能力,能够准确提取表名、字段定义、约束条件等关键信息,并以标准化的JSON结构输出。通过自动化的转换过程,显著提升数据库文档生成、架构分析和系统集成的效率,支持主流的SQL方言包括MySQL、PostgreSQL、Oracle等。转换结果保持原始DDL语句的完整语义,确保数据类型、主外键关系、索引定义等核心要素的准确映射,为数据可视化工具和自动化工作流提供标准化的数据输入。
{
"tables": [
{
"table_name": "app_user",
"columns": [
{
"name": "id",
"type": "BIGINT",
"constraints": ["PRIMARY KEY"]
},
{
"name": "username",
"type": "VARCHAR(32)",
"constraints": ["NOT NULL"]
},
{
"name": "email",
"type": "VARCHAR(64)",
"constraints": []
},
{
"name": "created_at",
"type": "TIMESTAMP",
"constraints": ["DEFAULT CURRENT_TIMESTAMP"]
},
{
"name": "last_login",
"type": "TIMESTAMP",
"constraints": []
}
],
"constraints": {
"primary_key": "PRIMARY KEY (id)",
"foreign_keys": [],
"indexes": [
{
"name": "idx_app_user_email",
"columns": ["email"]
}
]
}
},
{
"table_name": "user_profile",
"columns": [
{
"name": "user_id",
"type": "BIGINT",
"constraints": ["PRIMARY KEY"]
},
{
"name": "nickname",
"type": "VARCHAR(32)",
"constraints": []
},
{
"name": "bio",
"type": "VARCHAR(128)",
"constraints": []
}
],
"constraints": {
"primary_key": "PRIMARY KEY (user_id)",
"foreign_keys": [
{
"name": "fk_user_profile_user",
"columns": ["user_id"],
"references": {
"table": "app_user",
"columns": ["id"]
}
}
],
"indexes": []
}
}
]
}
{
"tables": [
{
"table_name": "user_account",
"columns": [
{
"name": "user_id",
"type": "bigint",
"constraints": ["primary key", "auto_increment"]
},
{
"name": "user_name",
"type": "varchar(32)",
"constraints": ["not null"]
},
{
"name": "created_at",
"type": "timestamp",
"constraints": ["not null"]
}
],
"constraints": {
"primary_key": "pk_user_account(user_id)",
"foreign_keys": [],
"checks": [],
"indexes": []
}
},
{
"table_name": "orders",
"columns": [
{
"name": "order_id",
"type": "bigint",
"constraints": ["primary key", "auto_increment"]
},
{
"name": "user_id",
"type": "bigint",
"constraints": ["not null"]
},
{
"name": "status",
"type": "char(1)",
"constraints": ["not null", "default 'N'"]
},
{
"name": "total_amount",
"type": "numeric(10,2)",
"constraints": ["not null"]
},
{
"name": "created_at",
"type": "timestamp",
"constraints": ["not null"]
}
],
"constraints": {
"primary_key": "pk_orders(order_id)",
"foreign_keys": [
"fk_orders_user(user_id) REFERENCES user_account(user_id)"
],
"checks": [
"chk_status (status IN ('N','P','C'))"
],
"indexes": []
}
},
{
"table_name": "order_item",
"columns": [
{
"name": "item_id",
"type": "bigint",
"constraints": ["primary key", "auto_increment"]
},
{
"name": "order_id",
"type": "bigint",
"constraints": ["not null"]
},
{
"name": "sku_code",
"type": "varchar(32)",
"constraints": ["not null"]
},
{
"name": "qty",
"type": "integer",
"constraints": ["not null"]
},
{
"name": "price",
"type": "numeric(10,2)",
"constraints": ["not null"]
}
],
"constraints": {
"primary_key": "pk_order_item(item_id)",
"foreign_keys": [
"fk_item_order(order_id) REFERENCES orders(order_id)"
],
"checks": [],
"indexes": []
}
}
],
"relationship_graph": [
{
"name": "fk_orders_user",
"from": "orders.user_id",
"to": "user_account.user_id"
},
{
"name": "fk_item_order",
"from": "order_item.order_id",
"to": "orders.order_id"
}
]
}
{
"tables": [
{
"table_name": "fact_order_daily",
"comment": "每日订单指标",
"columns": [
{
"name": "date_key",
"type": "INT",
"constraints": [
"NOT NULL"
],
"comment": "日期键"
},
{
"name": "gmv",
"type": "DECIMAL(12,2)",
"constraints": [
"NOT NULL"
],
"comment": "交易额"
},
{
"name": "order_cnt",
"type": "INT",
"constraints": [
"NOT NULL"
],
"comment": "订单数"
}
],
"constraints": {
"primary_key": "date_key",
"foreign_keys": [
{
"name": "fk_fact_date",
"columns": [
"date_key"
],
"references": {
"table": "dim_date",
"columns": [
"date_key"
]
}
}
],
"indexes": [
"idx_fact_date"
]
}
},
{
"table_name": "dim_date",
"columns": [
{
"name": "date_key",
"type": "INT",
"constraints": [
"PRIMARY KEY"
],
"comment": "日期键"
},
{
"name": "date_value",
"type": "DATE",
"constraints": [
"NOT NULL"
],
"comment": "日期值"
},
{
"name": "month",
"type": "INT",
"constraints": [
"NOT NULL"
],
"comment": "月份"
}
],
"constraints": {
"primary_key": "date_key",
"foreign_keys": [],
"indexes": []
}
}
]
}
快速产出结构化架构清单与变更摘要,批量比对版本差异,用于发布评审、容量规划与回滚预案。
将DDL转成结构化输入,驱动建模与ER图生成,统一主外键与命名规范,减少跨服务表结构偏差。
把脚本转换为统一结构,自动生成字段字典与指标映射,缩短看板配置与数据接入时间。
把复杂的SQL建表语句,一键转译成清晰、可复用的结构说明,帮助研发、数据、架构与运维在如下工作场景中快速提效:数据库文档自动生成、变更评审与合规检查、跨环境迁移与配置同步、数据建模与可视化。通过智能识别表名、字段、主外键、索引等核心要素,提供稳定且标准化的结构化输出,兼容常见数据库语法(如 MySQL、PostgreSQL、Oracle),显著降低人工解析成本与错误率。试用即可看到成效,进阶需求(如批量处理、质量校验、个性化格式规范)可平滑升级,助力团队从试用到付费落地。
将模板生成的提示词复制粘贴到您常用的 Chat 应用(如 ChatGPT、Claude 等),即可直接对话使用,无需额外开发。适合个人快速体验和轻量使用场景。
把提示词模板转化为 API,您的程序可任意修改模板参数,通过接口直接调用,轻松实现自动化与批量处理。适合开发者集成与业务系统嵌入。
在 MCP client 中配置对应的 server 地址,让您的 AI 应用自动调用提示词模板。适合高级用户和团队协作,让提示词在不同 AI 工具间无缝衔接。
免费获取高级提示词-优惠即将到期