快速生成符合用户需求的数据库结构,提供字段类型匹配及DDL语句输出。
以下是根据您的输入生成的数据库结构设计: ```json { "databaseSchema": "CREATE TABLE users (\n id INT PRIMARY KEY,\n username VARCHAR(255) NOT NULL,\n email VARCHAR(255) NOT NULL,\n created_at DATETIME NOT NULL\n);\n\nCREATE TABLE orders (\n id INT PRIMARY KEY,\n order_date DATETIME NOT NULL,\n total_amount DECIMAL(10,2) NOT NULL,\n user_id INT NOT NULL,\n FOREIGN KEY (user_id) REFERENCES users(id)\n);", "tables": [ { "tableName": "users", "fields": [ {"name": "id", "type": "INT", "isPrimaryKey": true}, {"name": "username", "type": "VARCHAR(255)", "isPrimaryKey": false}, {"name": "email", "type": "VARCHAR(255)", "isPrimaryKey": false}, {"name": "created_at", "type": "DATETIME", "isPrimaryKey": false} ] }, { "tableName": "orders", "fields": [ {"name": "id", "type": "INT", "isPrimaryKey": true}, {"name": "order_date", "type": "DATETIME", "isPrimaryKey": false}, {"name": "total_amount", "type": "DECIMAL(10,2)", "isPrimaryKey": false}, {"name": "user_id", "type": "INT", "isPrimaryKey": false} ] } ], "relationships": [ "orders.user_id -> users.id" ] } ``` ### 详细说明: - 表 `users` 的字段: - **id**:主键,类型为 `INT`。 - **username**:用户名称,类型为 `VARCHAR(255)`。 - **email**:用户邮箱,类型为 `VARCHAR(255)`。 - **created_at**:用户创建时间,类型为 `DATETIME`。 - 表 `orders` 的字段: - **id**:主键,类型为 `INT`。 - **order_date**:订单日期,类型为 `DATETIME`。 - **total_amount**:订单总金额,类型为 `DECIMAL(10,2)`。 - **user_id**:外键字段,用于关联 `users` 表的 `id`。 - 表间关系: - `orders.user_id` 是 `users.id` 的外键,用于表示订单属于哪个用户。 ### DDL语句: 生成的 DDL 语句可以直接在大多数主流数据库(如 MySQL、PostgreSQL)中执行,以创建相关的表结构。
```json { "databaseSchema": "CREATE TABLE products (\n product_id INT NOT NULL PRIMARY KEY,\n product_name VARCHAR(255) NOT NULL,\n price DECIMAL(10, 2) NOT NULL,\n stock INT NOT NULL\n);", "tables": [ { "tableName": "products", "fields": [ {"name": "product_id", "type": "INT", "isPrimaryKey": true}, {"name": "product_name", "type": "VARCHAR(255)", "isPrimaryKey": false}, {"name": "price", "type": "DECIMAL(10, 2)", "isPrimaryKey": false}, {"name": "stock", "type": "INT", "isPrimaryKey": false} ] } ], "relationships": [] } ```
```json { "databaseSchema": "CREATE TABLE orders (\n order_id INT PRIMARY KEY,\n user_id INT NOT NULL,\n total_price DECIMAL(10, 2) NOT NULL,\n order_date DATETIME NOT NULL,\n FOREIGN KEY (user_id) REFERENCES users(id)\n);", "tables": [ { "tableName": "orders", "fields": [ {"name": "order_id", "type": "INT", "isPrimaryKey": true}, {"name": "user_id", "type": "INT", "isPrimaryKey": false}, {"name": "total_price", "type": "DECIMAL(10, 2)", "isPrimaryKey": false}, {"name": "order_date", "type": "DATETIME", "isPrimaryKey": false} ] } ], "relationships": [ "orders.user_id -> users.id" ] } ```
在项目开发初期,可以快速生成符合规范的数据库结构,节约数据库设计的时间,将更多精力放在业务开发上。
刚接触数据库设计时,利用工具提供的清晰表结构和标准化DDL语句,更快理解设计逻辑和最佳实践。
在需要快速验证产品概念时,利用提示词一键生成数据库结构,帮助团队快速推进项目原型开发。
减少初期搭建数据库和关系模型的复杂度,快速满足功能实现需求,助力技术团队快速迭代。
在数据库搭建任务繁重时,利用工具实现快速自动化设计,大幅提升效率并确保设计一致性。
快速生成符合用户需求的数据库结构,为用户提供字段类型推荐及标准化的DDL语句,以满足开发初期、原型设计等场景快速落地的需求。
将模板生成的提示词复制粘贴到您常用的 Chat 应用(如 ChatGPT、Claude 等),即可直接对话使用,无需额外开发。适合个人快速体验和轻量使用场景。
把提示词模板转化为 API,您的程序可任意修改模板参数,通过接口直接调用,轻松实现自动化与批量处理。适合开发者集成与业务系统嵌入。
在 MCP client 中配置对应的 server 地址,让您的 AI 应用自动调用提示词模板。适合高级用户和团队协作,让提示词在不同 AI 工具间无缝衔接。
免费获取高级提示词-优惠即将到期