Loading...
Loading...
Compare original and translation side by side
| Level | Purpose | Audience | Detail |
|---|---|---|---|
| Conceptual | Business concepts | Business users | Entities, high-level relationships |
| Logical | Data structure | Analysts, designers | Entities, attributes, all relationships |
| Physical | Implementation | Developers, DBAs | Tables, columns, types, indexes |
| 层级 | 用途 | 受众 | 细节程度 |
|---|---|---|---|
| 概念层 | 业务概念 | 业务用户 | 实体、高层级关系 |
| 逻辑层 | 数据结构 | 分析师、设计师 | 实体、属性、所有关系 |
| 物理层 | 实现落地 | 开发人员、数据库管理员(DBAs) | 表、列、类型、索引 |
┌─────────────────┐
│ CUSTOMER │
├─────────────────┤
│ customer_id PK │
│ name │
│ email │
│ created_at │
└─────────────────┘| Type | Description | Example |
|---|---|---|
| Strong | Independent existence | Customer, Product |
| Weak | Depends on another entity | Order Line (depends on Order) |
| Associative | Resolves M:N relationships | Enrollment (Student-Course) |
┌─────────────────┐
│ CUSTOMER │
├─────────────────┤
│ customer_id PK │
│ name │
│ email │
│ created_at │
└─────────────────┘| 类型 | 描述 | 示例 |
|---|---|---|
| 强实体 | 可独立存在 | Customer、Product |
| 弱实体 | 依赖其他实体 | Order Line(依赖Order) |
| 关联实体 | 解决多对多关系 | Enrollment(Student-Course) |
| Type | Symbol | Description |
|---|---|---|
| Primary Key (PK) | Underlined/PK | Unique identifier |
| Foreign Key (FK) | FK | Reference to another entity |
| Required | * or NOT NULL | Must have value |
| Optional | ○ or NULL | May be empty |
| Derived | / | Calculated from other attributes |
| Composite | {attrs} | Made of sub-attributes |
| Multi-valued | [attr] | Can have multiple values |
| 类型 | 符号 | 描述 |
|---|---|---|
| 主键(PK) | 下划线/PK | 唯一标识符 |
| 外键(FK) | FK | 引用其他实体 |
| 必填 | * 或 NOT NULL | 必须有值 |
| 可选 | ○ 或 NULL | 可为空 |
| 派生 | / | 由其他属性计算得出 |
| 复合 | {attrs} | 由子属性组成 |
| 多值 | [attr] | 可拥有多个值 |
| Style | Used In |
|---|---|
| Chen | Academic, conceptual |
| Crow's Foot | Industry standard |
| UML | Software design |
| IDEF1X | Government, structured |
| Symbol | Meaning |
|---|---|
| One (mandatory) |
| Zero or one (optional) |
| Many |
| Zero or many |
| 风格 | 应用场景 |
|---|---|
| Chen | 学术、概念建模 |
| 乌鸦脚 | 行业标准 |
| UML | 软件设计 |
| IDEF1X | 政府、结构化建模 |
| 符号 | 含义 |
|---|---|
| 一个(强制) |
| 零或一个(可选) |
| 多个 |
| 零或多个 |
| Notation | Meaning | Example |
|---|---|---|
| 1:1 | One to one | Employee → Workstation |
| 1:M | One to many | Customer → Orders |
| M:N | Many to many | Students ↔ Courses |
| 符号 | 含义 | 示例 |
|---|---|---|
| 1:1 | 一对一 | Employee → Workstation |
| 1:M | 一对多 | Customer → Orders |
| M:N | 多对多 | Students ↔ Courses |
| Keep | Exclude |
|---|---|
| Independent concepts | Attributes (properties of entities) |
| Things with multiple instances | Synonyms (same concept, different name) |
| Things requiring data storage | Actions (verbs, not nouns) |
| 保留 | 排除 |
|---|---|
| 独立概念 | 属性(实体的特性) |
| 有多个实例的事物 | 同义词(同一概念的不同名称) |
| 需要存储数据的事物 | 动作(动词,非名词) |
undefinedundefined| Entity | Description | Example |
|---|---|---|
| Customer | Person or organization that purchases | John Smith, Acme Corp |
| Order | Purchase transaction | Order #12345 |
| Product | Item available for sale | Widget, Gadget |
undefined| 实体 | 描述 | 示例 |
|---|---|---|
| Customer | 进行购买的个人或组织 | John Smith、Acme Corp |
| Order | 购买交易 | 订单#12345 |
| Product | 可售卖的商品 | Widget、Gadget |
undefined| Attribute | Type | Required | Notes |
|---|---|---|---|
| customer_id | PK | Yes | Surrogate key |
| Unique | Yes | Business key | |
| name | String | Yes | |
| phone | String | No | Optional |
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| customer_id | PK | 是 | 代理键 |
| 唯一 | 是 | 业务键 | |
| name | 字符串 | 是 | |
| phone | 字符串 | 否 | 可选 |
undefinedundefined| Relationship | From | To | Cardinality | Description |
|---|---|---|---|---|
| places | Customer | Order | 1:M | Customer places orders |
| contains | Order | Product | M:N | Order contains products |
undefined| 关系 | 来源 | 目标 | 基数 | 描述 |
|---|---|---|---|---|
| places | Customer | Order | 1:M | 客户下订单 |
| contains | Order | Product | M:N | 订单包含商品 |
undefinedStudent ──M:N── Course
Becomes:
Student ──1:M── Enrollment ──M:1── CourseStudent ──M:N── Course
转换为:
Student ──1:M── Enrollment ──M:1── Course| Form | Rule | Violation Example |
|---|---|---|
| 1NF | Atomic values, no repeating groups | Phone1, Phone2, Phone3 |
| 2NF | No partial dependencies | Non-key depends on part of composite key |
| 3NF | No transitive dependencies | Non-key depends on non-key |
| BCNF | Every determinant is a candidate key | Overlap in candidate keys |
| 范式 | 规则 | 违规示例 |
|---|---|---|
| 1NF | 值为原子性,无重复组 | Phone1、Phone2、Phone3 |
| 2NF | 无部分依赖 | 非键属性依赖于复合键的一部分 |
| 3NF | 无传递依赖 | 非键属性依赖于其他非键属性 |
| BCNF | 每个决定因素都是候选键 | 候选键存在重叠 |
| Logical Type | Physical (PostgreSQL) | Physical (SQL Server) |
|---|---|---|
| String(50) | VARCHAR(50) | NVARCHAR(50) |
| Integer | INTEGER | INT |
| Decimal(10,2) | NUMERIC(10,2) | DECIMAL(10,2) |
| Date | DATE | DATE |
| Timestamp | TIMESTAMP | DATETIME2 |
| Boolean | BOOLEAN | BIT |
| 逻辑类型 | PostgreSQL 物理类型 | SQL Server 物理类型 |
|---|---|---|
| String(50) | VARCHAR(50) | NVARCHAR(50) |
| Integer | INTEGER | INT |
| Decimal(10,2) | NUMERIC(10,2) | DECIMAL(10,2) |
| Date | DATE | DATE |
| Timestamp | TIMESTAMP | DATETIME2 |
| Boolean | BOOLEAN | BIT |
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ ORDER_LINE : contains
PRODUCT ||--o{ ORDER_LINE : includes
CUSTOMER {
int customer_id PK
string name
string email UK
date created_at
}
ORDER {
int order_id PK
int customer_id FK
date order_date
decimal total
string status
}
ORDER_LINE {
int order_id PK,FK
int product_id PK,FK
int quantity
decimal unit_price
}
PRODUCT {
int product_id PK
string name
string sku UK
decimal price
int stock_qty
}erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ ORDER_LINE : contains
PRODUCT ||--o{ ORDER_LINE : includes
CUSTOMER {
int customer_id PK
string name
string email UK
date created_at
}
ORDER {
int order_id PK
int customer_id FK
date order_date
decimal total
string status
}
ORDER_LINE {
int order_id PK,FK
int product_id PK,FK
int quantity
decimal unit_price
}
PRODUCT {
int product_id PK
string name
string sku UK
decimal price
int stock_qty
}undefinedundefined| Column | Type | Null | Key | Default | Description |
|---|---|---|---|---|---|
| customer_id | INT | No | PK | AUTO | Unique identifier |
| name | VARCHAR(100) | No | Customer full name | ||
| VARCHAR(255) | No | UK | Contact email | ||
| phone | VARCHAR(20) | Yes | NULL | Contact phone | |
| created_at | TIMESTAMP | No | NOW() | Record creation |
pk_customeruk_customer_emailix_customer_nameundefined| 列 | 类型 | 可为空 | 键 | 默认值 | 描述 |
|---|---|---|---|---|---|
| customer_id | INT | 否 | PK | AUTO | 唯一标识符 |
| name | VARCHAR(100) | 否 | 客户全名 | ||
| VARCHAR(255) | 否 | UK | 联系邮箱 | ||
| phone | VARCHAR(20) | 是 | NULL | 联系电话 | |
| created_at | TIMESTAMP | 否 | NOW() | 记录创建时间 |
pk_customeruk_customer_emailix_customer_nameundefineddata_model:
name: "E-Commerce"
version: "1.0"
date: "2025-01-15"
level: "logical" # conceptual, logical, physical
analyst: "data-modeler"
entities:
- name: "Customer"
type: "strong"
description: "Person or organization that makes purchases"
attributes:
- name: "customer_id"
type: "integer"
key: "primary"
required: true
generated: true
- name: "email"
type: "string"
length: 255
key: "unique"
required: true
- name: "name"
type: "string"
length: 100
required: true
- name: "Order"
type: "strong"
description: "Purchase transaction"
attributes:
- name: "order_id"
type: "integer"
key: "primary"
required: true
- name: "customer_id"
type: "integer"
key: "foreign"
references: "Customer.customer_id"
required: true
relationships:
- name: "places"
from: "Customer"
to: "Order"
cardinality: "1:M"
from_participation: "optional" # 0..1
to_participation: "mandatory" # 1..M
description: "Customer places orders"
constraints:
- entity: "Customer"
type: "check"
expression: "LENGTH(name) >= 2"
description: "Name minimum length"
indexes:
- entity: "Order"
name: "ix_order_date"
columns: ["order_date"]
purpose: "Date range queries"data_model:
name: "E-Commerce"
version: "1.0"
date: "2025-01-15"
level: "logical" # conceptual, logical, physical
analyst: "data-modeler"
entities:
- name: "Customer"
type: "strong"
description: "Person or organization that makes purchases"
attributes:
- name: "customer_id"
type: "integer"
key: "primary"
required: true
generated: true
- name: "email"
type: "string"
length: 255
key: "unique"
required: true
- name: "name"
type: "string"
length: 100
required: true
- name: "Order"
type: "strong"
description: "Purchase transaction"
attributes:
- name: "order_id"
type: "integer"
key: "primary"
required: true
- name: "customer_id"
type: "integer"
key: "foreign"
references: "Customer.customer_id"
required: true
relationships:
- name: "places"
from: "Customer"
to: "Order"
cardinality: "1:M"
from_participation: "optional" # 0..1
to_participation: "mandatory" # 1..M
description: "Customer places orders"
constraints:
- entity: "Customer"
type: "check"
expression: "LENGTH(name) >= 2"
description: "Name minimum length"
indexes:
- entity: "Order"
name: "ix_order_date"
columns: ["order_date"]
purpose: "Date range queries"undefinedundefined| Entity | Description | Key Relationships |
|---|---|---|
| Customer | Purchasers | Places Orders |
| Order | Transactions | Belongs to Customer, Contains Products |
| Product | Items for sale | Included in Orders |
| Order Line | Order details | Links Order to Product |
| 实体 | 描述 | 关键关系 |
|---|---|---|
| Customer | 购买者 | 下订单 |
| Order | 交易记录 | 属于客户,包含商品 |
| Product | 在售商品 | 被包含在订单中 |
| Order Line | 订单详情 | 关联订单与商品 |
undefinedundefinederDiagram
PERSON ||--o| EMPLOYEE : "is a"
PERSON ||--o| CUSTOMER : "is a"
PERSON {
int person_id PK
string name
string email
}
EMPLOYEE {
int person_id PK,FK
date hire_date
decimal salary
}
CUSTOMER {
int person_id PK,FK
string company
decimal credit_limit
}erDiagram
PERSON ||--o| EMPLOYEE : "is a"
PERSON ||--o| CUSTOMER : "is a"
PERSON {
int person_id PK
string name
string email
}
EMPLOYEE {
int person_id PK,FK
date hire_date
decimal salary
}
CUSTOMER {
int person_id PK,FK
string company
decimal credit_limit
}erDiagram
EMPLOYEE ||--o{ EMPLOYEE : "manages"
EMPLOYEE {
int employee_id PK
string name
int manager_id FK
}erDiagram
EMPLOYEE ||--o{ EMPLOYEE : "manages"
EMPLOYEE {
int employee_id PK
string name
int manager_id FK
}erDiagram
ENTITY ||--o{ ENTITY_HISTORY : "has history"
ENTITY {
int id PK
string data
timestamp updated_at
}
ENTITY_HISTORY {
int history_id PK
int entity_id FK
string data
timestamp valid_from
timestamp valid_to
string changed_by
}erDiagram
ENTITY ||--o{ ENTITY_HISTORY : "has history"
ENTITY {
int id PK
string data
timestamp updated_at
}
ENTITY_HISTORY {
int history_id PK
int entity_id FK
string data
timestamp valid_from
timestamp valid_to
string changed_by
}process-modelingjourney-mappingdecision-analysiscapability-mappingprocess-modelingjourney-mappingdecision-analysiscapability-mapping