Relations

Learn how to set up and manage relationships between tables in the ERD.

Create Relation

Create a relation line representing the relationship between two tables.

1

Activate Relation Mode

Click the relation line icon in the toolbar to activate relation drawing mode.

2

Select Source Table

Click a column in the table that will hold the FK (child table).

3

Connect to Target Table

Click the PK column of the referenced table (parent table) to create the relation line.

관계선 생성

Identifying vs Non-Identifying Relationship

The toolbar provides two relation line modes. Choose the appropriate mode based on the nature of the relationship.

CategoryIdentifyingNon-Identifying
Toolbar icon식별 관계 아이콘 Identifying Relationship비식별 관계 아이콘 Non-Identifying Relationship
FK column positionIncluded in child table's PKRegular column in child table
Child record existenceCannot exist without parentCan exist without parent
ERD notationSolid line (FK is part of PK, so always NOT NULL)Solid line if FK is NOT NULL, dashed line if NULL allowed
ExampleOrder <-> Order Details, Post <-> AttachmentsUser <-> Orders, Department <-> Employees
Identifying Relationship

The parent table's PK is included as part of the child table's PK. The child record is dependent on the parent and cannot exist without it.

Example: The order_details table's PK is (order_id, detail_id), where order_id is an FK referencing the orders table's PK.

Non-Identifying Relationship

The parent table's PK is added as a regular column in the child table. The child record can exist independently of the parent.

Example: The employees table has a department_code column as an FK referencing the departments table's PK, but the employees table's PK is employee_id.

식별 관계 vs 비식별 관계

Relation Types (Cardinality)

Relation types supported in NeoSQL. The type is automatically determined based on the FK column's properties when a relation is created.

TypeNotationDescriptionCriteria
1:NOne-to-Many (mandatory)One parent record maps to multiple child records (FK NOT NULL)FK column is NOT NULL
1:0orNOne-to-Many (optional)One parent record maps to zero or more child records (FK NULL allowed)FK column is NULL allowed
N:NMany-to-ManyBoth tables map to multiple records on the other side (junction table required)FK column is part of a composite PK, and all PK columns are FKs
Auto-Detection Rules

When creating a relation, the relation type is automatically determined based on the FK column's nullable and PK inclusion status.

  • FK column is NOT NULL -> 1:N (mandatory, solid line)
  • FK column is NULL allowed -> 1:0orN (optional, dashed line)
  • All PK columns are FKs -> N:N (junction table, many-to-many)
관계 유형