SlideShare une entreprise Scribd logo
1  sur  52
Télécharger pour lire hors ligne
Miquel Boada Artigas
Model E-R
Miquel Boada Artigas
Database design
What do we need? / Specifications
Conceptual model
Entity-Relationship(ER)
Relational model
Data definition language
Miquel Boada Artigas
Model ER - Elements
●
Entity sets/entities
●
Relationship sets/Relationship
●
Attributes
Miquel Boada Artigas
Entity
●
Object (concrete or abstract) distinguishable from other objects.
●
Example
–40232423, Artur Mas (concrete: particular person)
●
Example
–Vacances a la Costa Brava, des del 03/08/2015 fins el 21/08/2015. (abstract)
Miquel Boada Artigas
Entity sets
●
Set of entities of the same type
●
Examples: Workers, vehicles, buildings ...
●
Examples: Departments, Salaries, holidays ...
Miquel Boada Artigas
Identifiers
●
Distinguish one entity from another.
●
Entity identifiers perform this function.
Miquel Boada Artigas
Exercicis
●
Indica els conjunts d'entitats necessàries per a la gestió d'una botiga d'informàtica.
●
Indica els conjunts d'entitats necessàries per a la gestió del club de Handbol de
Granollers.
●
Indica els conjunts d'entitats necessàries per a la gestió d'un parking.
●
Indica els conjunts d'entitats necessàries per a la gestió d'un joc de rol (informàtic).
Miquel Boada Artigas
Attributes
Miquel Boada Artigas
Attributes
●
Describes a property or characterstic of an entity.
●
An entity set is composed by one or more attributes.
●
It's identified by a name.
●
Two attributes with the same name are not allowed in the same entity
set.
Miquel Boada Artigas
Attributes - Example
SSN, Name, Surname are attributes
Miquel Boada Artigas
Attributes domain
●
Allowed values.
●
Example:
–Attribute: «Week's day»
–Values: sunday, monday, tuesday ….
–Attribute «Age» (persona)
–Values: 0 .. 130.
Miquel Boada Artigas
NULL values
●
Special name for «unknown» value.
●
Space or zero is not NULL (space and zero is a known values).
●
Examples:
–Qualification: NULL. (No results yet).
–Final match result: NULL (Not started).
Miquel Boada Artigas
Derived attribute
●
His value can be obtained from other attributes or related entities.
●
Examples:
–Age → if an attribute «date of birth» exists.
–Matches won → can get this value from an entity set «results».
Miquel Boada Artigas
Composite attribute
●
An attribute is composite if we can divide it on some other attributes.
●
The model ER is clearer.
●
Example:
–Name (person): name , surname.
–Direction: city, address, number ...
–Temperature: value, units.
Miquel Boada Artigas
Attribute hierarchy
●
A composite attribute can be formed by other
composite attributes.
Direction
City
Postal code
Name
Address Number
Simple attributes
Composite attributes
Miquel Boada Artigas
Univalued / multivalued
●
Can store one value => univalued attribute.
●
Can store many values => multivalued attribute.
●
Examples univalued:
–Name, date of birth (person), model (vehicle) …
●
Examples multivalued:
–Telephone, colors (product), languages, ...
Miquel Boada Artigas
Fictitious attributes
●
They don't add any meaning to the entity.
●
They are used like fictious identifiers attributes
●
Their use is not recommended.
●
Their use is acceptable when an entity is identified for 4 or more attributes.
●
Their implementation is based on the use of autonumeric values (1, 2, 3, ….)
Miquel Boada Artigas
Relationship sets
Miquel Boada Artigas
Relationship
●
Is a correlation between two or more entities.
●
Examples
–Pau Pi is learning databases systems.
–Volkswagen is producing a new car model.
–Pau Pi has bought a HP 14z Laptop computer.
Miquel Boada Artigas
Relationship sets
●
Is a correlation between two or more entity sets.
●
Examples
–Teachers and students.
–Customers and invoices.
–Warehouses and articles.
Miquel Boada Artigas
Relationship sets type
●
1 to 1 (1:1)
●
1 to N (1:N)
●
N to 1 (N:1)
●
N to M (N:M)
Miquel Boada Artigas
Relationship sets type (1:1)
●
One entity can be related to only one entity, and viceversa.
●
It is not frequent.
●
Example:
–Country and president
a1
a2
a3
a4
...
an
Entity set A
b1
b2
b3
b4
...
bn
Entity set B
Miquel Boada Artigas
Relationship sets type (1:N) / (N:1)
●
One entity can be related to many entities.
●
(1:N/N:1) depends on the order of entities sets.
●
Example:
–Country and monuments
a1
a2
a3
a4
...
an
Entity set A
b1
b2
b3
b4
...
bn
Entity set B
(1:N)
a1
a2
a3
a4
...
an
Entity set A
b1
b2
b3
b4
...
bn
Entity set B
(N:1)
Miquel Boada Artigas
Relationship sets type (N:M)
●
One entity can be related to many entities and
viceversa.
●
Example:
–Films and actors
a1
a2
a3
a4
...
an
Entity set A
b1
b2
b3
b4
...
bn
Entity set B
Miquel Boada Artigas
Participation
●
Total: all entities are related with another entity.
●
Partial: there're any entities not realet with any entity.
–«A» has a total participation in «B».
–«B» has a partial participation in «A».
a1
a2
a3
a4
...
an
Entity set A
b1
b2
b3
b4
...
bn
Entity set B
Miquel Boada Artigas
Participation - Examples
●
Total
–Vehicle and insurance.
–Book and author.
●
Partial
–Students and companies.
–Workers and computers.
Miquel Boada Artigas
Degree
●
Number of entity sets involved in a relationship.
●
Examples:
–Team has players: binary relationship.
–Players commit fouls in a match: ternary relationship.
Miquel Boada Artigas
Cardinality
●
Cardinality: set a minimun and maximun value to the relationship.
–Basket player commits fouls in a match.
–Relationship set: commit.
–Relationship set type: 1:N (player-fouls)
–Minimun value: 0
–Maximun value: 5
–
Miquel Boada Artigas
Candidate key
●
An entity can be identified by using differents attributes.
●
All the attributes that identifies an entity is a candidate key.
●
Example:
–A worker could be identified by: SSN, NIF. Both attributes are
candidate.
Strong & weak entities
Miquel Boada Artigas
Weak Entities
●
The existence of a weak entity depends on the existence of an identifying entity type (strong entity).
●
A weak entity has a relationship set (1:N or N:1), where 1 is strong entity and N weak entity.
●
Examples:
–Course (strong) and course-offering (weak).
–Match (strong) and goals (weak).
–Customer (strong) and sales (weak).
Miquel Boada Artigas
Graphical representation
Entity set Rel. set
Weak
entity set
Identifying
rel. set
Entity set Rel. setEntity set Rel. set
Entity set Rel. set
Miquel Boada Artigas
Graphical representation
Atr1: Simple, univalued
Atr2: Simple, multivalued
Atr3: Derived (univalued)
Atr4: Key attribute
Atr5: Candidate key
Atr6: Composite
Miquel Boada Artigas
Graphical representation
Miquel Boada Artigas
Graphical representation
Model ER
Examples
Miquel Boada Artigas
Exemple 1
Es necessita dissenyar un model ER que permeti controlar quins mòduls i
unitats formatives fa cada alumne.
Cada mòdul s'identifica per un codi. Altra informació que conforma el mòdul és
el nom associat i el total d'hores de les unitats formatives que el conformen.
De cada unitat formativa s'emmagatzemarà el seu codi, el nom de la unitat
formativa i les hores que la componen.
Miquel Boada Artigas
Biblioteca
Es necessita un model ER per a controlar la gestió d'una
biblioteca. Els socis de la biblioteca poden agafar llibres per un
període determinat. Es vol saber quins llibres té cada soci.
El temps que es pot agafar cada un dels llibres deprendrà del
tipus de llibre.
Reflexive or recursive
relationship
Miquel Boada Artigas
Reflexive relationship
●
Two entities belonging to the same entity set can be related. When
this occurs , we have an reflexive relationship.
●
Examples:
–An employee is supervised by one manager
–A course requires previous courses.
Miquel Boada Artigas
Graphical representation
Ternary relationship sets
Miquel Boada Artigas
Ternary relationship sets
●
A ternary relationship occurs when 3 entity sets are
involved in a relationship.
●
The relationship sets type is set taking two entities
sets and determining the type respect the other one.
Miquel Boada Artigas
Example
SOME ENTITY SETS VALUES
Supplier Part Vehicle
Michelin Wheel Volkswagen
Firestone Motor Renault
Electronic Motors Ford
Tesla Motors
Donada una peça (ex.: roda) i un proveïdor,
es pot suministrar a molts vehicles?
Resposta sí: Supplier/Part → tipus relació N
Miquel Boada Artigas
Example
SOME ENTITY SETS VALUES
Supplier Part Vehicle
Michelin Wheel Volkswagen
Firestone Motor Renault
Electronic Motors Ford
Tesla Motors
Donat un tipus de vehicle i una peça, aquesta
pot ser suministrada per molts proveïdors?
Resposta sí: Vehicle/Part → tipus relació M
N
Miquel Boada Artigas
Example
SOME ENTITY SETS VALUES
Supplier Part Vehicle
Michelin Wheel Volkswagen
Firestone Motor Renault
Electronic Motors Ford
Tesla Motors
Un proveïdor pot suministrar moltes peces per un tiNM
Resposta sí: Vehicle/Supplier → tipus relació P
NM
P
M:N:P
Model ER Extended
Miquel Boada Artigas
Generalization / Specialization
●
Two or more entity sets combines to form a higher level entity sets (generalization)
●
1 entity sets breaks in 2 or more entity sets to form a lower level entity sets
(specialization)
●
Examples:
–An entity sets teacher and student combines to form an entity sets Person (generalization)
–An entity sets vehicle breaks in different entity sets: car, truck, bus ... (specialization)
Miquel Boada Artigas
Generalization / Specialization
●
The attributes of the higher entity sets are inherited to the lower
level entity sets.
●
Each lower level entity sets has they own attribute sets.
–Example: dni is an attribute for person entity sets, while average
qualification is an attribute for student entity sets.
Miquel Boada Artigas
Basic graphical representation
Miquel Boada Artigas
Generalization / Specialization
●
Any entity sets can be related with any other
entity set.
Miquel Boada Artigas
Projectes
Es necessita un model ER per a controlar els projectes d'una empresa. Cada projecte està associat a un tipus (nous
productes, informàtica,...). Cada tipus de projecte té associat a un responsable, que serà l'encarregat de vetllar pel
bon funcionament de tots els projectes associats al tipus en concret. Apart del cap de projectes, a cada projecte hi
estan assignades una sèrie de persones. Una persona pot treballar en varis projectes al mateix temps.
Apart des recursos humans, per a cada un dels projectes es necessiten una sèrie de materials. Cada material
s'identifica per un codi. Un material només es podrà utilitzar en un projecte. Altra informació que es vol
emmagatzemar del material és la quantitat i el preu unitari.
De cada projecte és important saber el total de persones que té associades i el cost del material del mateix.

Contenu connexe

En vedette

Weak and strong forms
Weak and strong formsWeak and strong forms
Weak and strong formsSandy Millin
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2sadeenedian08
 
Entity (types, attibute types)
Entity (types, attibute types)Entity (types, attibute types)
Entity (types, attibute types)Zaheer Soomro
 
Most common weak forms in english
Most common weak forms in englishMost common weak forms in english
Most common weak forms in englishIbrahem Abdel Ghany
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Typesaakanksha s
 
Connected Speech - Weak forms
Connected Speech - Weak formsConnected Speech - Weak forms
Connected Speech - Weak formsJo Gakonga
 
Chapter 7 strong and weak forms
Chapter 7 strong and weak formsChapter 7 strong and weak forms
Chapter 7 strong and weak formsMarta Łopion
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbmsmaryeem
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Data base management system
Data base management systemData base management system
Data base management systemNavneet Jingar
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
12 u6-future jobs-part e-2
12 u6-future jobs-part e-212 u6-future jobs-part e-2
12 u6-future jobs-part e-2lunemo
 
Analyzing Types of Bilingual Education
Analyzing Types of Bilingual EducationAnalyzing Types of Bilingual Education
Analyzing Types of Bilingual EducationSteve McCarty
 

En vedette (17)

Weak and strong forms
Weak and strong formsWeak and strong forms
Weak and strong forms
 
English Phonology
English PhonologyEnglish Phonology
English Phonology
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2
 
Entity (types, attibute types)
Entity (types, attibute types)Entity (types, attibute types)
Entity (types, attibute types)
 
Most common weak forms in english
Most common weak forms in englishMost common weak forms in english
Most common weak forms in english
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Types
 
Connected Speech - Weak forms
Connected Speech - Weak formsConnected Speech - Weak forms
Connected Speech - Weak forms
 
Chapter 7 strong and weak forms
Chapter 7 strong and weak formsChapter 7 strong and weak forms
Chapter 7 strong and weak forms
 
Descriptions
DescriptionsDescriptions
Descriptions
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Data base management system
Data base management systemData base management system
Data base management system
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
12 u6-future jobs-part e-2
12 u6-future jobs-part e-212 u6-future jobs-part e-2
12 u6-future jobs-part e-2
 
Analyzing Types of Bilingual Education
Analyzing Types of Bilingual EducationAnalyzing Types of Bilingual Education
Analyzing Types of Bilingual Education
 
Weak,Strong Syllables
Weak,Strong SyllablesWeak,Strong Syllables
Weak,Strong Syllables
 

Plus de Miquel Boada Artigas

Configuració d'un sistema d'auditoria amb Windows Server
Configuració d'un sistema d'auditoria amb Windows ServerConfiguració d'un sistema d'auditoria amb Windows Server
Configuració d'un sistema d'auditoria amb Windows ServerMiquel Boada Artigas
 
Monitorització en sistemes informàtics. Windows i Linux.
Monitorització en sistemes informàtics. Windows i Linux.Monitorització en sistemes informàtics. Windows i Linux.
Monitorització en sistemes informàtics. Windows i Linux.Miquel Boada Artigas
 
LLenguatge SQL. Consultes utilitzant having
LLenguatge SQL. Consultes utilitzant havingLLenguatge SQL. Consultes utilitzant having
LLenguatge SQL. Consultes utilitzant havingMiquel Boada Artigas
 
LLenguatge SQL. Consultes amb agrupació de files.
LLenguatge SQL. Consultes amb agrupació de files. LLenguatge SQL. Consultes amb agrupació de files.
LLenguatge SQL. Consultes amb agrupació de files. Miquel Boada Artigas
 
Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...
Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...
Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...Miquel Boada Artigas
 
Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...
Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...
Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...Miquel Boada Artigas
 
Creació de taules amb integritat referencial.
Creació de taules amb integritat referencial.Creació de taules amb integritat referencial.
Creació de taules amb integritat referencial.Miquel Boada Artigas
 
Creació de base de dades utilitzant llenguatge SQL.
Creació de base de dades utilitzant llenguatge SQL.Creació de base de dades utilitzant llenguatge SQL.
Creació de base de dades utilitzant llenguatge SQL.Miquel Boada Artigas
 
Tema 01 - Creació de taules amb SQL.
Tema 01 - Creació de taules amb SQL.Tema 01 - Creació de taules amb SQL.
Tema 01 - Creació de taules amb SQL.Miquel Boada Artigas
 
Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...
Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...
Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...Miquel Boada Artigas
 
Transformació model entitat-relació al model relacional
Transformació model entitat-relació al model relacionalTransformació model entitat-relació al model relacional
Transformació model entitat-relació al model relacionalMiquel Boada Artigas
 
Model entitat relació extès (Extended Entity Relationship)
Model entitat relació extès (Extended Entity Relationship)Model entitat relació extès (Extended Entity Relationship)
Model entitat relació extès (Extended Entity Relationship)Miquel Boada Artigas
 
Introducció bases de dades distribuides
Introducció bases de dades distribuidesIntroducció bases de dades distribuides
Introducció bases de dades distribuidesMiquel Boada Artigas
 
Introducció bases de dades centralitzades
Introducció bases de dades centralitzadesIntroducció bases de dades centralitzades
Introducció bases de dades centralitzadesMiquel Boada Artigas
 
Sistemes gestors de bases de dades
Sistemes gestors de bases de dadesSistemes gestors de bases de dades
Sistemes gestors de bases de dadesMiquel Boada Artigas
 

Plus de Miquel Boada Artigas (20)

Configuracio servei dns_linux
Configuracio servei dns_linuxConfiguracio servei dns_linux
Configuracio servei dns_linux
 
Configuracio servei dns Windows
Configuracio servei dns WindowsConfiguracio servei dns Windows
Configuracio servei dns Windows
 
Configuració d'un sistema d'auditoria amb Windows Server
Configuració d'un sistema d'auditoria amb Windows ServerConfiguració d'un sistema d'auditoria amb Windows Server
Configuració d'un sistema d'auditoria amb Windows Server
 
Monitorització en sistemes informàtics. Windows i Linux.
Monitorització en sistemes informàtics. Windows i Linux.Monitorització en sistemes informàtics. Windows i Linux.
Monitorització en sistemes informàtics. Windows i Linux.
 
LLenguatge SQL. Consultes utilitzant having
LLenguatge SQL. Consultes utilitzant havingLLenguatge SQL. Consultes utilitzant having
LLenguatge SQL. Consultes utilitzant having
 
LLenguatge SQL. Consultes amb agrupació de files.
LLenguatge SQL. Consultes amb agrupació de files. LLenguatge SQL. Consultes amb agrupació de files.
LLenguatge SQL. Consultes amb agrupació de files.
 
Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...
Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...
Consultes amb múltiples taules utilitzant left, right i inner join. Funcionam...
 
Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...
Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...
Consultes simples mitjançant llenguatge SQL. Filtres, ordenació i aplicació d...
 
Creació de taules amb integritat referencial.
Creació de taules amb integritat referencial.Creació de taules amb integritat referencial.
Creació de taules amb integritat referencial.
 
Creació de base de dades utilitzant llenguatge SQL.
Creació de base de dades utilitzant llenguatge SQL.Creació de base de dades utilitzant llenguatge SQL.
Creació de base de dades utilitzant llenguatge SQL.
 
Tema 01 - Creació de taules amb SQL.
Tema 01 - Creació de taules amb SQL.Tema 01 - Creació de taules amb SQL.
Tema 01 - Creació de taules amb SQL.
 
Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...
Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...
Instal·lació MySQL Server i Workbench. Creació de base de dades. Tipus de dad...
 
Model relacional i normalització
Model relacional i normalitzacióModel relacional i normalització
Model relacional i normalització
 
Transformació model entitat-relació al model relacional
Transformació model entitat-relació al model relacionalTransformació model entitat-relació al model relacional
Transformació model entitat-relació al model relacional
 
Model entitat relació extès (Extended Entity Relationship)
Model entitat relació extès (Extended Entity Relationship)Model entitat relació extès (Extended Entity Relationship)
Model entitat relació extès (Extended Entity Relationship)
 
Model entitat relació (ER)
Model entitat relació (ER)Model entitat relació (ER)
Model entitat relació (ER)
 
Introducció bases de dades distribuides
Introducció bases de dades distribuidesIntroducció bases de dades distribuides
Introducció bases de dades distribuides
 
Introducció bases de dades centralitzades
Introducció bases de dades centralitzadesIntroducció bases de dades centralitzades
Introducció bases de dades centralitzades
 
Sistemes gestors de bases de dades
Sistemes gestors de bases de dadesSistemes gestors de bases de dades
Sistemes gestors de bases de dades
 
Emmagatzematge de la informació
Emmagatzematge de la informacióEmmagatzematge de la informació
Emmagatzematge de la informació
 

Dernier

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Dernier (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

ER Model for Company Projects

  • 2. Miquel Boada Artigas Database design What do we need? / Specifications Conceptual model Entity-Relationship(ER) Relational model Data definition language
  • 3. Miquel Boada Artigas Model ER - Elements ● Entity sets/entities ● Relationship sets/Relationship ● Attributes
  • 4. Miquel Boada Artigas Entity ● Object (concrete or abstract) distinguishable from other objects. ● Example –40232423, Artur Mas (concrete: particular person) ● Example –Vacances a la Costa Brava, des del 03/08/2015 fins el 21/08/2015. (abstract)
  • 5. Miquel Boada Artigas Entity sets ● Set of entities of the same type ● Examples: Workers, vehicles, buildings ... ● Examples: Departments, Salaries, holidays ...
  • 6. Miquel Boada Artigas Identifiers ● Distinguish one entity from another. ● Entity identifiers perform this function.
  • 7. Miquel Boada Artigas Exercicis ● Indica els conjunts d'entitats necessàries per a la gestió d'una botiga d'informàtica. ● Indica els conjunts d'entitats necessàries per a la gestió del club de Handbol de Granollers. ● Indica els conjunts d'entitats necessàries per a la gestió d'un parking. ● Indica els conjunts d'entitats necessàries per a la gestió d'un joc de rol (informàtic).
  • 9. Miquel Boada Artigas Attributes ● Describes a property or characterstic of an entity. ● An entity set is composed by one or more attributes. ● It's identified by a name. ● Two attributes with the same name are not allowed in the same entity set.
  • 10. Miquel Boada Artigas Attributes - Example SSN, Name, Surname are attributes
  • 11. Miquel Boada Artigas Attributes domain ● Allowed values. ● Example: –Attribute: «Week's day» –Values: sunday, monday, tuesday …. –Attribute «Age» (persona) –Values: 0 .. 130.
  • 12. Miquel Boada Artigas NULL values ● Special name for «unknown» value. ● Space or zero is not NULL (space and zero is a known values). ● Examples: –Qualification: NULL. (No results yet). –Final match result: NULL (Not started).
  • 13. Miquel Boada Artigas Derived attribute ● His value can be obtained from other attributes or related entities. ● Examples: –Age → if an attribute «date of birth» exists. –Matches won → can get this value from an entity set «results».
  • 14. Miquel Boada Artigas Composite attribute ● An attribute is composite if we can divide it on some other attributes. ● The model ER is clearer. ● Example: –Name (person): name , surname. –Direction: city, address, number ... –Temperature: value, units.
  • 15. Miquel Boada Artigas Attribute hierarchy ● A composite attribute can be formed by other composite attributes. Direction City Postal code Name Address Number Simple attributes Composite attributes
  • 16. Miquel Boada Artigas Univalued / multivalued ● Can store one value => univalued attribute. ● Can store many values => multivalued attribute. ● Examples univalued: –Name, date of birth (person), model (vehicle) … ● Examples multivalued: –Telephone, colors (product), languages, ...
  • 17. Miquel Boada Artigas Fictitious attributes ● They don't add any meaning to the entity. ● They are used like fictious identifiers attributes ● Their use is not recommended. ● Their use is acceptable when an entity is identified for 4 or more attributes. ● Their implementation is based on the use of autonumeric values (1, 2, 3, ….)
  • 19. Miquel Boada Artigas Relationship ● Is a correlation between two or more entities. ● Examples –Pau Pi is learning databases systems. –Volkswagen is producing a new car model. –Pau Pi has bought a HP 14z Laptop computer.
  • 20. Miquel Boada Artigas Relationship sets ● Is a correlation between two or more entity sets. ● Examples –Teachers and students. –Customers and invoices. –Warehouses and articles.
  • 21. Miquel Boada Artigas Relationship sets type ● 1 to 1 (1:1) ● 1 to N (1:N) ● N to 1 (N:1) ● N to M (N:M)
  • 22. Miquel Boada Artigas Relationship sets type (1:1) ● One entity can be related to only one entity, and viceversa. ● It is not frequent. ● Example: –Country and president a1 a2 a3 a4 ... an Entity set A b1 b2 b3 b4 ... bn Entity set B
  • 23. Miquel Boada Artigas Relationship sets type (1:N) / (N:1) ● One entity can be related to many entities. ● (1:N/N:1) depends on the order of entities sets. ● Example: –Country and monuments a1 a2 a3 a4 ... an Entity set A b1 b2 b3 b4 ... bn Entity set B (1:N) a1 a2 a3 a4 ... an Entity set A b1 b2 b3 b4 ... bn Entity set B (N:1)
  • 24. Miquel Boada Artigas Relationship sets type (N:M) ● One entity can be related to many entities and viceversa. ● Example: –Films and actors a1 a2 a3 a4 ... an Entity set A b1 b2 b3 b4 ... bn Entity set B
  • 25. Miquel Boada Artigas Participation ● Total: all entities are related with another entity. ● Partial: there're any entities not realet with any entity. –«A» has a total participation in «B». –«B» has a partial participation in «A». a1 a2 a3 a4 ... an Entity set A b1 b2 b3 b4 ... bn Entity set B
  • 26. Miquel Boada Artigas Participation - Examples ● Total –Vehicle and insurance. –Book and author. ● Partial –Students and companies. –Workers and computers.
  • 27. Miquel Boada Artigas Degree ● Number of entity sets involved in a relationship. ● Examples: –Team has players: binary relationship. –Players commit fouls in a match: ternary relationship.
  • 28. Miquel Boada Artigas Cardinality ● Cardinality: set a minimun and maximun value to the relationship. –Basket player commits fouls in a match. –Relationship set: commit. –Relationship set type: 1:N (player-fouls) –Minimun value: 0 –Maximun value: 5 –
  • 29. Miquel Boada Artigas Candidate key ● An entity can be identified by using differents attributes. ● All the attributes that identifies an entity is a candidate key. ● Example: –A worker could be identified by: SSN, NIF. Both attributes are candidate.
  • 30. Strong & weak entities
  • 31. Miquel Boada Artigas Weak Entities ● The existence of a weak entity depends on the existence of an identifying entity type (strong entity). ● A weak entity has a relationship set (1:N or N:1), where 1 is strong entity and N weak entity. ● Examples: –Course (strong) and course-offering (weak). –Match (strong) and goals (weak). –Customer (strong) and sales (weak).
  • 32. Miquel Boada Artigas Graphical representation Entity set Rel. set Weak entity set Identifying rel. set Entity set Rel. setEntity set Rel. set Entity set Rel. set
  • 33. Miquel Boada Artigas Graphical representation Atr1: Simple, univalued Atr2: Simple, multivalued Atr3: Derived (univalued) Atr4: Key attribute Atr5: Candidate key Atr6: Composite
  • 37. Miquel Boada Artigas Exemple 1 Es necessita dissenyar un model ER que permeti controlar quins mòduls i unitats formatives fa cada alumne. Cada mòdul s'identifica per un codi. Altra informació que conforma el mòdul és el nom associat i el total d'hores de les unitats formatives que el conformen. De cada unitat formativa s'emmagatzemarà el seu codi, el nom de la unitat formativa i les hores que la componen.
  • 38. Miquel Boada Artigas Biblioteca Es necessita un model ER per a controlar la gestió d'una biblioteca. Els socis de la biblioteca poden agafar llibres per un període determinat. Es vol saber quins llibres té cada soci. El temps que es pot agafar cada un dels llibres deprendrà del tipus de llibre.
  • 40. Miquel Boada Artigas Reflexive relationship ● Two entities belonging to the same entity set can be related. When this occurs , we have an reflexive relationship. ● Examples: –An employee is supervised by one manager –A course requires previous courses.
  • 43. Miquel Boada Artigas Ternary relationship sets ● A ternary relationship occurs when 3 entity sets are involved in a relationship. ● The relationship sets type is set taking two entities sets and determining the type respect the other one.
  • 44. Miquel Boada Artigas Example SOME ENTITY SETS VALUES Supplier Part Vehicle Michelin Wheel Volkswagen Firestone Motor Renault Electronic Motors Ford Tesla Motors Donada una peça (ex.: roda) i un proveïdor, es pot suministrar a molts vehicles? Resposta sí: Supplier/Part → tipus relació N
  • 45. Miquel Boada Artigas Example SOME ENTITY SETS VALUES Supplier Part Vehicle Michelin Wheel Volkswagen Firestone Motor Renault Electronic Motors Ford Tesla Motors Donat un tipus de vehicle i una peça, aquesta pot ser suministrada per molts proveïdors? Resposta sí: Vehicle/Part → tipus relació M N
  • 46. Miquel Boada Artigas Example SOME ENTITY SETS VALUES Supplier Part Vehicle Michelin Wheel Volkswagen Firestone Motor Renault Electronic Motors Ford Tesla Motors Un proveïdor pot suministrar moltes peces per un tiNM Resposta sí: Vehicle/Supplier → tipus relació P NM P M:N:P
  • 48. Miquel Boada Artigas Generalization / Specialization ● Two or more entity sets combines to form a higher level entity sets (generalization) ● 1 entity sets breaks in 2 or more entity sets to form a lower level entity sets (specialization) ● Examples: –An entity sets teacher and student combines to form an entity sets Person (generalization) –An entity sets vehicle breaks in different entity sets: car, truck, bus ... (specialization)
  • 49. Miquel Boada Artigas Generalization / Specialization ● The attributes of the higher entity sets are inherited to the lower level entity sets. ● Each lower level entity sets has they own attribute sets. –Example: dni is an attribute for person entity sets, while average qualification is an attribute for student entity sets.
  • 50. Miquel Boada Artigas Basic graphical representation
  • 51. Miquel Boada Artigas Generalization / Specialization ● Any entity sets can be related with any other entity set.
  • 52. Miquel Boada Artigas Projectes Es necessita un model ER per a controlar els projectes d'una empresa. Cada projecte està associat a un tipus (nous productes, informàtica,...). Cada tipus de projecte té associat a un responsable, que serà l'encarregat de vetllar pel bon funcionament de tots els projectes associats al tipus en concret. Apart del cap de projectes, a cada projecte hi estan assignades una sèrie de persones. Una persona pot treballar en varis projectes al mateix temps. Apart des recursos humans, per a cada un dels projectes es necessiten una sèrie de materials. Cada material s'identifica per un codi. Un material només es podrà utilitzar en un projecte. Altra informació que es vol emmagatzemar del material és la quantitat i el preu unitari. De cada projecte és important saber el total de persones que té associades i el cost del material del mateix.