Note: there are different forms of ERD but nowadays most are based on Class Diagram
for our lessons we will use PlanUML
@startuml
' hide the spot
hide circle
' avoid problems with angled crows feet
skinparam linetype ortho
entity "Entity01" as e01 {
*e1_id : number <<generated>>
--
*name : text
description : text
}
entity "Entity02" as e02 {
*e2_id : number <<generated>>
--
*e1_id : number <<FK>>
other_details : text
}
e01 ||..o{ e02
@enduml
install by
choco install plantuml
brew install plantuml
or
@startuml
entity Entity01 {
* identifying_attribute
--
* mandatory_attribute
optional_attribute
}
@enduml
Entity names are:
Attribute names:
ring and dash → minimum zero, maximum one (optional)
dash and dash → minimum one, maximum one (mandatory)
ring and crow's foot → minimum zero, maximum many (opt)
dash and crow's foot → minimum one, maximum many (m)
@startuml
Entity01 }|..|| Entity02
Entity03 }o..o| Entity04
Entity05 ||--o{ Entity06
Entity07 |o--|| Entity08
@enduml
one to many
foreign key placed on many side
many to many
there is a binding table with foreign keys pointing to both tables
someone create a composite primary key in the binding table
better is to put there auto generated key
generate test data using Mockaroo
is used to select the right elements.
We will use it later in XSLT
child::book | Selects all book nodes that are children of the current node |
attribute::lang | Selects the lang attribute of the current node |
child::* | Selects all element children of the current node |
attribute::* | Selects all attributes of the current node |
child::text() | Selects all text node children of the current node |
child::node() | Selects all children of the current node |
descendant::book | Selects all book descendants of the current node |
ancestor::book | Selects all book ancestors of the current node |
ancestor-or-self::book | Selects all book ancestors of the current node - and the current as well if it is a book node |
child::*/child::price | Selects all price grandchildren of the current node |
/bookstore/book/price[text()]
/bookstore/book[1]/title
/bookstore/book[price>35]/price