chartletv0.21.0chartlet.casoon.de

← All examples

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
Shop database
Shop databaseClass diagram with 4 classes and 3 relations. customers: 3 attributes, 0 methods. customers is associated with orders (1 : 0..*). orders: 4 attributes, 0 methods. orders is associated with order_items (1 : 1..*). order_items: 3 attributes, 0 methods. products: 4 attributes, 0 methods. products is associated with order_items (1 : 0..*).customers → orders0..*1orders → order_items1..*1products → order_items0..*1customerscustomersid (PK)emailcreated_atordersordersid (PK)customer_id (FK)placed_atstatusorder_itemsorder_itemsorder_id (PK, FK)product_id (PK, FK)quantityproductsproductsid (PK)skunameprice

Source: Illustrative schema

Show chart data
Data for Shop database
ItemKindAttributesMethodsRelations
customersEntityid (PK); email; created_atis associated with orders (1 : 0..*)
ordersEntityid (PK); customer_id (FK); placed_at; statusis associated with order_items (1 : 1..*)
order_itemsEntityorder_id (PK, FK); product_id (PK, FK); quantity
productsEntityid (PK); sku; name; priceis associated with order_items (1 : 0..*)
  • Entity-relationship diagram
  • Show a database schema