Shop database
Four tables of a shop as entities with their keys, joined by relations with cardinalities: the same diagram type as the class diagram, without methods. The table lists every entity with its columns and relations.
Shop database
examples/shop-schema.json{
"schemaVersion": 1,
"type": "classes",
"title": "Shop database",
"source": "Illustrative schema",
"width": 820,
"height": 520,
"classes": {
"classes": [
{
"id": "customers",
"label": "customers",
"kind": "entity",
"attributes": [
"id (PK)",
"email",
"created_at"
]
},
{
"id": "orders",
"label": "orders",
"kind": "entity",
"attributes": [
"id (PK)",
"customer_id (FK)",
"placed_at",
"status"
]
},
{
"id": "items",
"label": "order_items",
"kind": "entity",
"attributes": [
"order_id (PK, FK)",
"product_id (PK, FK)",
"quantity"
]
},
{
"id": "products",
"label": "products",
"kind": "entity",
"attributes": [
"id (PK)",
"sku",
"name",
"price"
]
}
],
"relations": [
{
"from": "customers",
"to": "orders",
"fromCardinality": "1",
"toCardinality": "0..*"
},
{
"from": "orders",
"to": "items",
"fromCardinality": "1",
"toCardinality": "1..*"
},
{
"from": "products",
"to": "items",
"fromCardinality": "1",
"toCardinality": "0..*"
}
]
}
}Focus
Source: Illustrative schema
Show chart data
| Item | Kind | Attributes | Methods | Relations |
|---|---|---|---|---|
| customers | Entity | id (PK); email; created_at | is associated with orders (1 : 0..*) | |
| orders | Entity | id (PK); customer_id (FK); placed_at; status | is associated with order_items (1 : 1..*) | |
| order_items | Entity | order_id (PK, FK); product_id (PK, FK); quantity | ||
| products | Entity | id (PK); sku; name; price | is associated with order_items (1 : 0..*) |