UML vs. ERD: Class, Sequence, and ER Diagram Examples
Shusaku Yosa

UML, or Unified Modeling Language, describes a system’s structure and behavior. A UML class diagram shows elements and their relationships. A sequence diagram shows how participants exchange messages over time. An entity–relationship diagram (ERD) shows the data a system stores and how records relate. Choose the diagram that answers the question you need to resolve. OMG’s UML 2.5.1 specification
All three examples below use one fictional feature. A requester submits a budget request, and an assigned approver reviews it.
Which diagram should you use?
Question to answer | Diagram | Example question |
|---|---|---|
What are the main concepts, responsibilities, and relationships? | UML class diagram | How does a request relate to its line items? |
What happens in what order, including branches? | UML sequence diagram | At what point does the service check approval permissions? |
What data do we store, and how do the records connect? | ERD | Which key links a line item to its request? |
UML also includes use case diagrams for actors and goals and activity diagrams for process flows and decisions. A swimlane diagram can help when the focus is on how teams hand off work. How to draw a swimlane diagram
Draw a class diagram for requests and line items
Put each class name in a box. Add attributes and operations where they help explain the class. Connect related classes with a line and show the multiplicity at each end. Multiplicity describes how many instances can be associated with one instance at the other end. Here, a submitted request has one or more line items, and each line item belongs to one request.

Start by asking what each element knows, what it does, and what it relates to. If a draft request can contain no line items, scope the diagram to submitted requests or record the draft rule alongside it.
Draw a sequence diagram for the approval flow
Arrange participants horizontally and place each message in order from top to bottom. In this example, the assigned approver can approve a pending request. Include the service response so the team can review what the screen does on both success and failure.

If two actions can run concurrently, make the update conditional on the request still being pending and the approver still being assigned. Return an outcome the screen can show if either condition changes before the update. Start with the success path, then add branches for missing permissions, requests already handled, and failures as needed.
Draw an ERD for the stored records
In a database ERD, each box represents an entity and can list its columns and keys. A primary key (PK) uniquely identifies a row. A foreign key (FK) references a row in another table in this example. A budget request is identified by request_id, and each line item uses its own request_id column to reference the parent. PostgreSQL documentation on constraints

This diagram covers submitted requests. A required foreign key with a reference constraint connects each line item to an existing request. Enforce the separate rule that a submitted request must have at least one line item when the request is submitted.
Copyable diagram planning template
Get the editable Mermaid examples for all three diagrams. Paste the code into a Mermaid editor and change the names and relationships to match your feature.
Field | Your notes |
|---|---|
Question the diagram should answer | |
Scope and assumptions | |
Classes, attributes, operations, and multiplicity | |
Sequence participants, messages, and branches | |
ERD entities, keys, and cardinality | |
Rules for exceptions |
If you use several diagrams, check that they use the same terminology and scope. Agree on what “submitted,” “pending,” and “approved” mean before reviewing the diagrams together. How to document requirements