Upload
marco-cersosimo
View
204
Download
7
Embed Size (px)
Citation preview
PATTY’S DAYCARE CENTRE
‘The 4 SQLers'Emma Berlese 839160
Alberto Bragagnolo 832517Nicholas Righetto 855524Marco Cersosimo 837354
Information Systems and NetworksA.Y. 2014/2015Prof. Albarelli
A parent registers their child or children at the school using a registration form and can submit more than one registration form
Each room in the daycare is assigned an age group (Infants under 1 year of age ; Toddlers from 1 to 3)
A child is assigned to a room based on their age and availability of space
KEY POINTS
A room may be assigned one or more employees
An employee can only be assigned to one room
The minimum number of employees for a room is determined by the number of children assigned to the room and the child:staff ratio identified by the government
ROOMSEMPLOYEES
AGE GROUPCHILDREN
SPECIAL NEEDS
Goes in
Belongs to
RelaPveSSN
Address
HomeContact
MobileContact
RelaPon
AuthorContact
AuthorPickUp
ID_Needs
Name Sex DateOfBirthChild_ID
AgeGroup_ID
StartDate
GovRaPo
RoomID Capacity
Employee_ID
Name
WeeklyHours
MonthlyWage
Entity-‐Relationship Diagram
Contains
HasRELATIVES
Is related
to
Name
RelaPveSSN
Address
HomeContact
Is related
toCHILDREN
AuthorPickUp
AuthorContact
RelaPon
RELATIVES
MobileContact
Name
Sex
DateOfBirth
Child_ID
RELATIVES -‐ CHILDREN
Relationship: Many to many
The parent that fills out the registration is one, but he or she may also indicate other relatives (or even friends) that:
• Have a certain relation with the children (uncle, sister, grandmother, etc…)
• Can be authorized to pick up the children
• Can be contacted in case of need
Name
‘Is Related to’ attributes:
(Relative_SSN, Child_ID, Relation, AuthorPickUp, AuthorContact)
Type:Relation: TEXTAuthorizationPickUp: BOOLEAN, AuthorizationContact: BOOLEAN
Relatives’ attributes:
Relative_SSN: VARCHAR (16)Name: TEXTAddress: TEXTHomeContact: VARCHAR (20)MobileContact: VARCHAR (20)
Relative_SSN Name Address HomeConta
ctMobileConta
ct
BNCFRN459F3.. Francesca Bianchi
Via Roma 1, Mestre…. 003941234293 3345938209
VRDVTR824E2.. Vittorio Verdi Piazza Maggiore 65/A, Padova… 003942983730 3470921092
RSSMRC435T4.. Marco Rossi Via Pio X 45, Vicenza… 003942504048 3459201919
NRICHR826R2.. Chiara Neri Via della libertà 30, Mestre… 003944492839 3338893234
Relative_SSN Child_ID Relation AuthorPickUp AuthorContact
BNCFRN459F3.. 0001 Mother 1 1
VRDVTR824E2.. 0002 Father 1 0
RSSMRC435T4.. 0003 Uncle 0 1
NRICHR826R2.. 0004 Cousin 0 0
‘RELATIVES’ and ‘IS RELATED TO’
Relative_SSN Child_ID Relation AuthorPickU
pAuthorConta
ctBNCFRN459
F3..0001 Mother 1 1
VRDVTR824E2..
0002 Father 1 0
RSSMRC435T4..
0003 Uncle 0 1
NRICHR826R2..
0004 Cousin 0 0
Is related
to
AuthorPickUp
AuthorContact
RelaPon
RELATIVES CHILDREN
RELATIVE TYPE
Rel_type
RELATIVE TYPE OPTIMIZATION
Is Related to (Rel_SSN, Child_ID, Rel_Type, AuthPickUp, AuthContact
Relative Type (Rel_type)
Name Sex DateOfBirthChild_ID
CHILDREN SPECIAL NEEDS
ID_Needs
CHILDREN – SPECIAL NEEDS
Has
Relationship: Many to many
The parent fills a registration form where they indicate the informations of the child: name, sex, date of birth
• In the same form, they can also signal the child’s special needs (intolerances to food, diseases or other problems)
Children (ENTITY SET):
Child_ID: INT or VARCHAR(16) Name: TEXT Sex: CHAR DateOfBirth: DATE
Children (Child_ID, Name, Sex, Date of Birth)
‘Children’, ‘Has’ and ‘Special Needs’
Special Needs (ENTITY SET)
Needs_ID: STRING
RELATIONSHIP
Has (Child_ID, Needs_ID)
Child_ID Name Sex DateOfBirth
0001 Dan Peterson M 02/01/1992
0002 Andrew Greg M 03/04/1992
0003 John Hopkins M 05/06/1992
0004 Angela Merkel F 07/08/1992
CHILDREN-‐AGE GROUP
AGE GROUP
CHILDREN Belongs to
Name Sex DateOfBirthChild_ID AgeGroup_ID StartDate
GovRatio
Relationship: Many to one
Belongs to ( Child_ID, AgeGroup_ID)
Children ( Child_ID, Name, Sex, Date of Birth, AgeGroup_ID)
ROOMS-‐AGE GROUP
ROOMS
RoomID Capacity
AGE GROUP
AgeGroup_ID
StartDate GovRatio
Contains
Relationship: Many to (at most) one
• The ROOMS entity is composed of two attributes: RoomID (primary key) and capacity.
• RoomID will be a univocal attribute of the room and each room can have at most 1 age group assigned. This is to keep into account that not all the rooms may be used
• Capacity attribute is also important because a child is assigned to a room also considering its availability of space
• The AGE GROUP entity is shaped by the AgeGroup ID (primary key), StartDate, GovRatio attributes.
• AgeGroup ID attribute is needed to distinguish children between INFANT ( < 1 year) and TODDLERS (1-3 years).
• GovRatio attribute informs us about how many children inside the room need the supervision of one employee according to the governmental requirement.
• StartDate attribute is necessary to define the date of birth of children that belong to the age group
ROOMS-‐AGE GROUP
‘ROOMS’ AND ‘AGE GROUP’
Room_ID Capacity
1 10
2 15
3 20
AgeGroup_ID StartDate GovRatio
Infant 2014/09/28 5
Toddler 2012/09/28 8
Rooms attributes:
Room_ID : STRINGCapacity : INT
Age Group attributes:
AgeGroup_ID : TEXTStartDate : DATEGovRatio : NUMBER
ATTRIBUTES OF ‘CONTAINS’
Room_ID AgeGroup_ID
1 Infant
2 Toddler
3 Toddler
Contains ( Room_ID, AgeGroup_ID)
Rooms (Room_ID, Capacity, AgeGroup_ID)
Contains
Attributes: Room_ID : STRINGAgeGroup_ID : TEXT
EMPLOYEES -‐ ROOMS
EMPLOYEES
Employee_ID
Name
WeeklyHours
MonthlyWage
Goes in ROOMS
RoomID Capacity
Relationship: Many to (exactly) One
• Each employee can only be assigned to one room.
• The employee is identified by an unique ID, and by other attributes that are useful for the working relationship such as name, monthly wage and weekly hours.
• The rooms are identified by an unique ID and by the availability of space that they offer.
Employees’ attributes:
Employee_ID: STRING Name: TEXT Weekly Hours: INT MonthlyWage: DECIMAL
(Employee_ID, Name, MonthlyWage, WeeklyWage)
Employee_ID Name WeeklyHours Monthly wage
BNCLUS459F3.. Luisa Bianchi 20 600,00
SRRFSC824E2.. Francesca Sarri 40 1200,00
RSSSAR435T4.. Sara Rossi 40 1200,00
Rooms attributes:
Room_ID: STRING Capacity: INT
(Room_ ID, Capacity)
Room_ID Capacity
1 10
2 15
3 20
Goes in (Employee_ID, Room_ID)
‘Employees’ and ‘Rooms’
(Employee_ID, Name, MonthlyWage, WeeklyWage, Room_ID)
Thank you for your attention!