Date post: | 06-Apr-2018 |
Category: |
Documents |
Upload: | danny-manno |
View: | 217 times |
Download: | 0 times |
of 13
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
1/13
22/07/2010
1
22 July, 2010 2. 1ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Database and InformationDatabase and InformationDatabase and InformationDatabase and InformationRetrievalRetrievalRetrievalRetrieval
ICT118Lecture 2 Relational Theory
Entities and Normalisation
22 July, 2010 2. 2ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Database DesignDatabase DesignDatabase DesignDatabase Design
Storage of business information in a databaseStorage of business information in a databaseStorage of business information in a databaseStorage of business information in a databasemust be plannedmust be plannedmust be plannedmust be planned
Current database design is based on CoddsCurrent database design is based on CoddsCurrent database design is based on CoddsCurrent database design is based on Coddsrelational theoryrelational theoryrelational theoryrelational theory
Business needBusiness needBusiness needBusiness need entity identificationentity identificationentity identificationentity identification ERDERDERDERD
modellingmodellingmodellingmodelling normalisationnormalisationnormalisationnormalisation db designdb designdb designdb design
22 July, 2010 2. 3ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
EntitiesEntitiesEntitiesEntitiesIdentifiable things of interest to the businessIdentifiable things of interest to the businessIdentifiable things of interest to the businessIdentifiable things of interest to the business
Entities do something or record somethingEntities do something or record somethingEntities do something or record somethingEntities do something or record something
Entities interact with other entities in theEntities interact with other entities in theEntities interact with other entities in theEntities interact with other entities in thebusinessbusinessbusinessbusiness interaction implies processinginteraction implies processinginteraction implies processinginteraction implies processing
Entities have attributesEntities have attributesEntities have attributesEntities have attributes
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
2/13
22/07/2010
2
22 July, 2010 2. 4ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
EntityEntityEntityEntity----Relationship ModelRelationship ModelRelationship ModelRelationship Model
Used to depict the relationship thatUsed to depict the relationship thatUsed to depict the relationship thatUsed to depict the relationship thatexists among entitiesexists among entitiesexists among entitiesexists among entities
The following relationship types can beThe following relationship types can beThe following relationship types can beThe following relationship types can beincluded in an Eincluded in an Eincluded in an Eincluded in an E----R model:R model:R model:R model:
One-to-one
One-to-many
Many-to-many
22 July, 2010 2. 5ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
EEEE----R Model Notation ExamplesR Model Notation ExamplesR Model Notation ExamplesR Model Notation Examples
One to one One to many
Many to many
EnrolmentStudent
Student Subject
Subject Examination
22 July, 2010 2. 6ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Notation conventionsNotation conventionsNotation conventionsNotation conventionsCardinality is the term which indicates theCardinality is the term which indicates theCardinality is the term which indicates theCardinality is the term which indicates the
number of required instances at each end ofnumber of required instances at each end ofnumber of required instances at each end ofnumber of required instances at each end ofa relationshipa relationshipa relationshipa relationship
One instance
Many instances
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
3/13
22/07/2010
3
22 July, 2010 2. 7ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Notation conventionsNotation conventionsNotation conventionsNotation conventionsOptionality indicates whether or not anOptionality indicates whether or not anOptionality indicates whether or not anOptionality indicates whether or not an
instance of an entity must exist in theinstance of an entity must exist in theinstance of an entity must exist in theinstance of an entity must exist in therelationship, or is optional. Numeric rangesrelationship, or is optional. Numeric rangesrelationship, or is optional. Numeric rangesrelationship, or is optional. Numeric rangescan be specifiedcan be specifiedcan be specifiedcan be specified
OptionalOptionalOptionalOptional
MandatoryMandatoryMandatoryMandatory
0..*
22 July, 2010 2. 8ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
OneOneOneOne----totototo----One RelationshipOne RelationshipOne RelationshipOne Relationship
A record in one entity is related to only oneA record in one entity is related to only oneA record in one entity is related to only oneA record in one entity is related to only onerecord in the other entityrecord in the other entityrecord in the other entityrecord in the other entity
Example: Each aircraft passenger is allocatedExample: Each aircraft passenger is allocatedExample: Each aircraft passenger is allocatedExample: Each aircraft passenger is allocatedone seat, and each seat is allocated to justone seat, and each seat is allocated to justone seat, and each seat is allocated to justone seat, and each seat is allocated to justone passengerone passengerone passengerone passenger
PASSENGER SEAT
22 July, 2010 2. 9ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
OneOneOneOne----totototo----Many RelationshipMany RelationshipMany RelationshipMany Relationship
Each record in one entity can be related to oneEach record in one entity can be related to oneEach record in one entity can be related to oneEach record in one entity can be related to oneor more records in the other entityor more records in the other entityor more records in the other entityor more records in the other entity
Example: A class has only one lecturer, butExample: A class has only one lecturer, butExample: A class has only one lecturer, butExample: A class has only one lecturer, buteach lecturer can teach many classeseach lecturer can teach many classeseach lecturer can teach many classeseach lecturer can teach many classes
LECTURER CLASS1..4
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
4/13
22/07/2010
4
22 July, 2010 2. 10ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
ManyManyManyMany----totototo----Many RelationshipMany RelationshipMany RelationshipMany Relationship
Each record in an entity can be related toEach record in an entity can be related toEach record in an entity can be related toEach record in an entity can be related tomultiple occurrences in the other entitymultiple occurrences in the other entitymultiple occurrences in the other entitymultiple occurrences in the other entity
Example: A student can take many classes,Example: A student can take many classes,Example: A student can take many classes,Example: A student can take many classes,and each class is composed of manyand each class is composed of manyand each class is composed of manyand each class is composed of manystudentsstudentsstudentsstudents
STUDENT CLASS
10..25
1..5
22 July, 2010 2. 11ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
EntityEntityEntityEntity----Relationship DiagramRelationship DiagramRelationship DiagramRelationship Diagram(ERD)(ERD)(ERD)(ERD)A diagrammatic representation of theA diagrammatic representation of theA diagrammatic representation of theA diagrammatic representation of the
relationships between all entities of interestrelationships between all entities of interestrelationships between all entities of interestrelationships between all entities of interestin a business situationin a business situationin a business situationin a business situation
Forms the basis for building a databaseForms the basis for building a databaseForms the basis for building a databaseForms the basis for building a database afterafterafterafter
the process of normalisationthe process of normalisationthe process of normalisationthe process of normalisation
22 July, 2010 2. 12ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
JustLee Example EJustLee Example EJustLee Example EJustLee Example E----R ModelR ModelR ModelR Model
Figure 1-4 An E-R model for JustLee Books
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
5/13
22/07/2010
5
22 July, 2010 2. 13ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
AttributesAttributesAttributesAttributesAn individual field that describes one aspect ofAn individual field that describes one aspect ofAn individual field that describes one aspect ofAn individual field that describes one aspect of
the entitythe entitythe entitythe entityA name Size12 100mm bolt
An identifier 0844255
A date 04-MAY-2010
A measurement 328
A reference 0844320
One or more attributes will uniquely identifyOne or more attributes will uniquely identifyOne or more attributes will uniquely identifyOne or more attributes will uniquely identifyeach instance of the entity (the key)each instance of the entity (the key)each instance of the entity (the key)each instance of the entity (the key)
22 July, 2010 2. 14ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
AttributesAttributesAttributesAttributes
An entity wil l be composed of (described by) aAn entity will be composed of (described by) aAn entity wil l be composed of (described by) aAn entity will be composed of (described by) acollection of attributes which taken togethercollection of attributes which taken togethercollection of attributes which taken togethercollection of attributes which taken togetherrepresent that entityrepresent that entityrepresent that entityrepresent that entityName
Description
Size
ClassificationQuantity
The values of each attribute distinguish oneThe values of each attribute distinguish oneThe values of each attribute distinguish oneThe values of each attribute distinguish oneinstance of an entity from anotherinstance of an entity from anotherinstance of an entity from anotherinstance of an entity from another
22 July, 2010 2. 15ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Attribute sharingAttribute sharingAttribute sharingAttribute sharing
One particular attribute may beOne particular attribute may beOne particular attribute may beOne particular attribute may beassociated with several entitiesassociated with several entitiesassociated with several entitiesassociated with several entities
Product identifier in:Product identifier in:Product identifier in:Product identifier in:PRODUCT entity
ORDER entity
DELIVERY entity
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
6/13
22/07/2010
6
22 July, 2010 2. 16ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Functional DependencyFunctional DependencyFunctional DependencyFunctional Dependency
The concept that one thing depends on theThe concept that one thing depends on theThe concept that one thing depends on theThe concept that one thing depends on thevalue of another, (or that one thing isvalue of another, (or that one thing isvalue of another, (or that one thing isvalue of another, (or that one thing isdetermined by the value of another)determined by the value of another)determined by the value of another)determined by the value of another)
e.g. I need milk and it costs $1.50 per litre.e.g. I need milk and it costs $1.50 per litre.e.g. I need milk and it costs $1.50 per litre.e.g. I need milk and it costs $1.50 per litre.How much do I pay for milk? 2 litres = $3.00,How much do I pay for milk? 2 litres = $3.00,How much do I pay for milk? 2 litres = $3.00,How much do I pay for milk? 2 litres = $3.00,5 litres = $7.505 litres = $7.505 litres = $7.505 litres = $7.50
The amount I pay is determined by (dependentThe amount I pay is determined by (dependentThe amount I pay is determined by (dependentThe amount I pay is determined by (dependenton) the number of litreson) the number of litreson) the number of litreson) the number of litres
Quantity is the determinant of amount paidQuantity is the determinant of amount paidQuantity is the determinant of amount paidQuantity is the determinant of amount paid
Amount paid is functionally dependent onAmount paid is functionally dependent onAmount paid is functionally dependent onAmount paid is functionally dependent onquantityquantityquantityquantity
22 July, 2010 2. 17ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Determinants and RelationsDeterminants and RelationsDeterminants and RelationsDeterminants and Relations
Relational theory requires one determinant onlyRelational theory requires one determinant onlyRelational theory requires one determinant onlyRelational theory requires one determinant onlyfor a relation (table)for a relation (table)for a relation (table)for a relation (table)
A determinant is called a key, and there may beA determinant is called a key, and there may beA determinant is called a key, and there may beA determinant is called a key, and there may beseveral keys in the entities that we find. A keyseveral keys in the entities that we find. A keyseveral keys in the entities that we find. A keyseveral keys in the entities that we find. A keyor determinant is said toor determinant is said toor determinant is said toor determinant is said to IdentifyIdentifyIdentifyIdentify a relationa relationa relationa relation
The Normalisation process modifies our entitiesThe Normalisation process modifies our entitiesThe Normalisation process modifies our entitiesThe Normalisation process modifies our entitiesinto relations having a single determinantinto relations having a single determinantinto relations having a single determinantinto relations having a single determinant
One unOne unOne unOne un----normalised entity will probably producenormalised entity will probably producenormalised entity will probably producenormalised entity will probably produceseveral normalised relationsseveral normalised relationsseveral normalised relationsseveral normalised relations
22 July, 2010 2. 18ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Functional dependency and keysFunctional dependency and keysFunctional dependency and keysFunctional dependency and keys
Example from the text book.Example from the text book.Example from the text book.Example from the text book.
Where the value of an attribute can only haveWhere the value of an attribute can only haveWhere the value of an attribute can only haveWhere the value of an attribute can only haveone value for each value of its key attributeone value for each value of its key attributeone value for each value of its key attributeone value for each value of its key attribute
Publication date can only have one value forPublication date can only have one value forPublication date can only have one value forPublication date can only have one value foreach value of the key attribute ISBNeach value of the key attribute ISBNeach value of the key attribute ISBNeach value of the key attribute ISBN
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
7/13
22/07/2010
7
22 July, 2010 2. 19ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Notation conventionsNotation conventionsNotation conventionsNotation conventionsEntities are recorded as sequential lists ofEntities are recorded as sequential lists ofEntities are recorded as sequential lists ofEntities are recorded as sequential lists ofattributes within bracketsattributes within bracketsattributes within bracketsattributes within brackets
The primary identifying attribute(s) orThe primary identifying attribute(s) orThe primary identifying attribute(s) orThe primary identifying attribute(s) oridentifier, or key, or determinant is underlinedidentifier, or key, or determinant is underlinedidentifier, or key, or determinant is underlinedidentifier, or key, or determinant is underlined
Product (Product-code, Product-descr, Supplier-identifier, Quantity-on-hand, UOM, Reorder-qty,Cost, Retail, Product-family)
22 July, 2010 2. 20ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Notation conventionsNotation conventionsNotation conventionsNotation conventionsSome groups of attributes occur several timesSome groups of attributes occur several timesSome groups of attributes occur several timesSome groups of attributes occur several times
in any one instance of an entityin any one instance of an entityin any one instance of an entityin any one instance of an entity
Multiple subject results for one studentMultiple subject results for one studentMultiple subject results for one studentMultiple subject results for one studentStudent (Student-num, Course-code, Course-type,
Enrol-date, Finish-date, Graduation-date
(Subject-code, subject-name, semester, year,score, grade), term-address, home-address,Enrolment-type)
Follow this format convention for definingFollow this format convention for definingFollow this format convention for definingFollow this format convention for definingentitiesentitiesentitiesentities
22 July, 2010 2. 21ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Storing Entities in a databaseStoring Entities in a databaseStoring Entities in a databaseStoring Entities in a databaseEntities are stored in tables that conform toEntities are stored in tables that conform toEntities are stored in tables that conform toEntities are stored in tables that conform to
Codds relational theoryCodds relational theoryCodds relational theoryCodds relational theory
Table (or Relation) is a collection of rows ofTable (or Relation) is a collection of rows ofTable (or Relation) is a collection of rows ofTable (or Relation) is a collection of rows ofattributes that must have one value only in eachattributes that must have one value only in eachattributes that must have one value only in eachattributes that must have one value only in eachattributeattributeattributeattribute
Every row must have the same structureEvery row must have the same structureEvery row must have the same structureEvery row must have the same structure(sequence of attributes)(sequence of attributes)(sequence of attributes)(sequence of attributes)
Therefore a table resembles a regular matrixTherefore a table resembles a regular matrixTherefore a table resembles a regular matrixTherefore a table resembles a regular matrix
Normalisation produces correctly structuredNormalisation produces correctly structuredNormalisation produces correctly structuredNormalisation produces correctly structuredtablestablestablestables
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
8/13
22/07/2010
8
22 July, 2010 2. 22ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Entity NormalisationEntity NormalisationEntity NormalisationEntity NormalisationCreates entities where all attributes areCreates entities where all attributes areCreates entities where all attributes areCreates entities where all attributes are
functionally dependent on the key attribute(s)functionally dependent on the key attribute(s)functionally dependent on the key attribute(s)functionally dependent on the key attribute(s)
Eliminates the anomalies associated with unEliminates the anomalies associated with unEliminates the anomalies associated with unEliminates the anomalies associated with un----normalised entitiesnormalised entitiesnormalised entitiesnormalised entities
Minimises the number of entities in which aMinimises the number of entities in which aMinimises the number of entities in which aMinimises the number of entities in which agiven attribute must be storedgiven attribute must be storedgiven attribute must be storedgiven attribute must be stored
Normalisation is a multiNormalisation is a multiNormalisation is a multiNormalisation is a multi----step process that youstep process that youstep process that youstep process that youperform onperform onperform onperform on everyeveryeveryevery entityentityentityentity
Six normal forms (NF) exist. We focus on 4 only:Six normal forms (NF) exist. We focus on 4 only:Six normal forms (NF) exist. We focus on 4 only:Six normal forms (NF) exist. We focus on 4 only:
First NF, Second NF, Third NF, BoyceFirst NF, Second NF, Third NF, BoyceFirst NF, Second NF, Third NF, BoyceFirst NF, Second NF, Third NF, Boyce----Codd NFCodd NFCodd NFCodd NF
22 July, 2010 2. 23ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
DefinitionsDefinitionsDefinitionsDefinitions [1][1][1][1]1NF: if, and only if, all underlying attribute1NF: if, and only if, all underlying attribute1NF: if, and only if, all underlying attribute1NF: if, and only if, all underlying attributevalues are atomic (i.e. cannot be meaningfullyvalues are atomic (i.e. cannot be meaningfullyvalues are atomic (i.e. cannot be meaningfullyvalues are atomic (i.e. cannot be meaningfullydecomposed)decomposed)decomposed)decomposed)
2NF: if, and only if, it is in 1NF and every non2NF: if, and only if, it is in 1NF and every non2NF: if, and only if, it is in 1NF and every non2NF: if, and only if, it is in 1NF and every non----key attribute is fully dependent on the primarykey attribute is fully dependent on the primarykey attribute is fully dependent on the primarykey attribute is fully dependent on the primarykeykeykeykey
3NF: if, and only if, it is in 2NF and every non3NF: if, and only if, it is in 2NF and every non3NF: if, and only if, it is in 2NF and every non3NF: if, and only if, it is in 2NF and every non----key attribute is nonkey attribute is nonkey attribute is nonkey attribute is non----transitively dependent ontransitively dependent ontransitively dependent ontransitively dependent onthe primary keythe primary keythe primary keythe primary key
[1] C.J. Date, An Introduction to Database Systems, 5th edn, Vol.1.Reading MA: Addison-Wesley, 1990, pp532-557.
22 July, 2010 2. 24ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
DefinitionsDefinitionsDefinitionsDefinitions
BoyceBoyceBoyceBoyce----Codd Normal Form (BCNF) is a variantCodd Normal Form (BCNF) is a variantCodd Normal Form (BCNF) is a variantCodd Normal Form (BCNF) is a variantof 3NF for special cases:of 3NF for special cases:of 3NF for special cases:of 3NF for special cases:
1.1.1.1. when there are multiple candidate keyswhen there are multiple candidate keyswhen there are multiple candidate keyswhen there are multiple candidate keys
2.2.2.2. those candidate keys are composite keysthose candidate keys are composite keysthose candidate keys are composite keysthose candidate keys are composite keys
3.3.3.3. those candidate keys overlappedthose candidate keys overlappedthose candidate keys overlappedthose candidate keys overlapped
These cases are less common and we willThese cases are less common and we willThese cases are less common and we willThese cases are less common and we willrestrict our interest to the first three normalrestrict our interest to the first three normalrestrict our interest to the first three normalrestrict our interest to the first three normal
formsformsformsforms
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
9/13
22/07/2010
9
22 July, 2010 2. 25ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Normalisation ProcessNormalisation ProcessNormalisation ProcessNormalisation ProcessIdentify the attributes for each entity. TheseIdentify the attributes for each entity. TheseIdentify the attributes for each entity. TheseIdentify the attributes for each entity. These
are the unare the unare the unare the un----normalised entities (UNF)normalised entities (UNF)normalised entities (UNF)normalised entities (UNF)
Identify keys (uniquely identifying attributes)Identify keys (uniquely identifying attributes)Identify keys (uniquely identifying attributes)Identify keys (uniquely identifying attributes)
Identify then resolve nonIdentify then resolve nonIdentify then resolve nonIdentify then resolve non----atomic attributesatomic attributesatomic attributesatomic attributes(repeating groups) (1NF)(repeating groups) (1NF)(repeating groups) (1NF)(repeating groups) (1NF)
Identify then resolve partial dependenciesIdentify then resolve partial dependenciesIdentify then resolve partial dependenciesIdentify then resolve partial dependencies(2NF)(2NF)(2NF)(2NF)
Identify then resolve transitive dependenciesIdentify then resolve transitive dependenciesIdentify then resolve transitive dependenciesIdentify then resolve transitive dependencies(3NF)(3NF)(3NF)(3NF)
22 July, 2010 2. 26ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Normalisation ProcessNormalisation ProcessNormalisation ProcessNormalisation ProcessSelect an entitySelect an entitySelect an entitySelect an entity
Identify its attributes (ignore calculated fields)Identify its attributes (ignore calculated fields)Identify its attributes (ignore calculated fields)Identify its attributes (ignore calculated fields)
Do any of these recur as a repeating group?Do any of these recur as a repeating group?Do any of these recur as a repeating group?Do any of these recur as a repeating group?For any single instance of the entity are thererepetitions of groups of attributes?
Student:Identifier Does it Repeat? no
Names Does it Repeat? no
Address Does it Repeat? no
Subjects Does it Repeat? yes
22 July, 2010 2. 27ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Normalisation processNormalisation processNormalisation processNormalisation process
Document using the conventional formatDocument using the conventional formatDocument using the conventional formatDocument using the conventional format
Primary keys are identified (Primary keys are identified (Primary keys are identified (Primary keys are identified (underlinedunderlinedunderlinedunderlined))))
Repeating groups are removed into a new entity, alongRepeating groups are removed into a new entity, alongRepeating groups are removed into a new entity, alongRepeating groups are removed into a new entity, alongwith the primary keywith the primary keywith the primary keywith the primary key
Student (Student (Student (Student (StudentStudentStudentStudent----numnumnumnum, Course, Course, Course, Course----code, Coursecode, Coursecode, Coursecode, Course----type, Enroltype, Enroltype, Enroltype, Enrol----date, Finishdate, Finishdate, Finishdate, Finish----date, Graduatedate, Graduatedate, Graduatedate, Graduate----datedatedatedate((((SubjectSubjectSubjectSubject----codecodecodecode, subject, subject, subject, subject----name, semester,name, semester,name, semester,name, semester,year, score, grade), termyear, score, grade), termyear, score, grade), termyear, score, grade), term----address, homeaddress, homeaddress, homeaddress, home----address, Enrolmentaddress, Enrolmentaddress, Enrolmentaddress, Enrolment----type)type)type)type)
becomes:becomes:becomes:becomes:
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
10/13
22/07/2010
10
22 July, 2010 2. 28ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Normalisation ProcessNormalisation ProcessNormalisation ProcessNormalisation ProcessStudent (Student (Student (Student (StudentStudentStudentStudent----numnumnumnum, Course, Course, Course, Course----code, Coursecode, Coursecode, Coursecode, Course----
type, Enroltype, Enroltype, Enroltype, Enrol----date, Finishdate, Finishdate, Finishdate, Finish----date, Graduatedate, Graduatedate, Graduatedate, Graduate----date,date,date,date,TermTermTermTerm----address, Homeaddress, Homeaddress, Homeaddress, Home----address, Enrolmentaddress, Enrolmentaddress, Enrolmentaddress, Enrolment----type)type)type)type)
plusplusplusplus
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode,,,,subjectsubjectsubjectsubject----name,name,name,name, semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)
Both are in First Normal Form (1NF)Both are in First Normal Form (1NF)Both are in First Normal Form (1NF)Both are in First Normal Form (1NF)
22 July, 2010 2. 29ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Anomalies from unAnomalies from unAnomalies from unAnomalies from un----normalisednormalisednormalisednormaliseddatadatadatadataEnrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode,,,,
subjectsubjectsubjectsubject----name,name,name,name, semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)
Delete anomalyDelete anomalyDelete anomalyDelete anomaly can lose student data when acan lose student data when acan lose student data when acan lose student data when asubject record is deletedsubject record is deletedsubject record is deletedsubject record is deleted
Insert anomalyInsert anomalyInsert anomalyInsert anomaly require information aboutrequire information aboutrequire information aboutrequire information about
multiple entities when wanting to add justmultiple entities when wanting to add justmultiple entities when wanting to add justmultiple entities when wanting to add justoneoneoneone
Update anomalyUpdate anomalyUpdate anomalyUpdate anomaly one column value changeone column value changeone column value changeone column value changerequires repetition of the change for everyrequires repetition of the change for everyrequires repetition of the change for everyrequires repetition of the change for everyrecordrecordrecordrecord
22 July, 2010 2. 30ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Normalisation ProcessNormalisation ProcessNormalisation ProcessNormalisation ProcessRetain every attribute from the UNF collectionRetain every attribute from the UNF collectionRetain every attribute from the UNF collectionRetain every attribute from the UNF collection
in the new 1NF collectionsin the new 1NF collectionsin the new 1NF collectionsin the new 1NF collections
Do not invent/create new attributesDo not invent/create new attributesDo not invent/create new attributesDo not invent/create new attributes
Remember to copy the key of the original unRemember to copy the key of the original unRemember to copy the key of the original unRemember to copy the key of the original un----normalised entity into the new entity formednormalised entity into the new entity formednormalised entity into the new entity formednormalised entity into the new entity formed
from the Repeating group of attributesfrom the Repeating group of attributesfrom the Repeating group of attributesfrom the Repeating group of attributes
If there is NO Repeating groupIf there is NO Repeating groupIf there is NO Repeating groupIf there is NO Repeating group then thethen thethen thethen theoriginal entity is already in First Normal Formoriginal entity is already in First Normal Formoriginal entity is already in First Normal Formoriginal entity is already in First Normal Form
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
11/13
22/07/2010
11
22 July, 2010 2. 31ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
1NF to 2NF process1NF to 2NF process1NF to 2NF process1NF to 2NF process1NF entities with a single attribute as key are1NF entities with a single attribute as key are1NF entities with a single attribute as key are1NF entities with a single attribute as key are
already in 2NF !already in 2NF !already in 2NF !already in 2NF !
The process only applies to 1NF entities with aThe process only applies to 1NF entities with aThe process only applies to 1NF entities with aThe process only applies to 1NF entities with acompound key (2 or more attributes)compound key (2 or more attributes)compound key (2 or more attributes)compound key (2 or more attributes)
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode,,,,subjectsubjectsubjectsubject----name,name,name,name, semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)
22 July, 2010 2. 32ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Check if any attributes are functionallyCheck if any attributes are functionallyCheck if any attributes are functionallyCheck if any attributes are functionallydependent on only part of the compound keydependent on only part of the compound keydependent on only part of the compound keydependent on only part of the compound key
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode,,,,subjectsubjectsubjectsubject----name,name,name,name, semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)
SubjectSubjectSubjectSubject----name and semester are functionallyname and semester are functionallyname and semester are functionallyname and semester are functionallydependent only on Subjectdependent only on Subjectdependent only on Subjectdependent only on Subject----code because, ifcode because, ifcode because, ifcode because, ifonly Studentonly Studentonly Studentonly Student----num changed, subjectnum changed, subjectnum changed, subjectnum changed, subject----namenamenamenameand semester would NOT changeand semester would NOT changeand semester would NOT changeand semester would NOT change
1NF to 2NF Process1NF to 2NF Process1NF to 2NF Process1NF to 2NF Process
22 July, 2010 2. 33ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode,,,,subjectsubjectsubjectsubject----name,name,name,name, semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)semester, year, score, grade)
Becomes:Becomes:Becomes:Becomes:
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode, year,, year,, year,, year,score, grade)score, grade)score, grade)score, grade)
PlusPlusPlusPlus
Subject (Subject (Subject (Subject (SubjectSubjectSubjectSubject----codecodecodecode, subject, subject, subject, subject----name,name,name,name,semester)semester)semester)semester)
All in second normal form (2NF)All in second normal form (2NF)All in second normal form (2NF)All in second normal form (2NF)
1NF to 2NF Process1NF to 2NF Process1NF to 2NF Process1NF to 2NF Process
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
12/13
22/07/2010
12
22 July, 2010 2. 34ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Current entity statusCurrent entity statusCurrent entity statusCurrent entity statusStudent (Student (Student (Student (StudentStudentStudentStudent----numnumnumnum, Course, Course, Course, Course----code, Coursecode, Coursecode, Coursecode, Course----
type, Enroltype, Enroltype, Enroltype, Enrol----date, Finishdate, Finishdate, Finishdate, Finish----date, Graduatedate, Graduatedate, Graduatedate, Graduate----date,date,date,date,TermTermTermTerm----address, Homeaddress, Homeaddress, Homeaddress, Home----address, Enrolmentaddress, Enrolmentaddress, Enrolmentaddress, Enrolment----type)type)type)type)
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode, year,, year,, year,, year,score, grade)score, grade)score, grade)score, grade)
Subject (Subject (Subject (Subject (SubjectSubjectSubjectSubject----codecodecodecode, subject, subject, subject, subject----name,name,name,name,semester)semester)semester)semester)
All in second normal form (2NF)All in second normal form (2NF)All in second normal form (2NF)All in second normal form (2NF)
22 July, 2010 2. 35ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
2NF to 3NF Process2NF to 3NF Process2NF to 3NF Process2NF to 3NF ProcessCheck if any attributes are functionallyCheck if any attributes are functionallyCheck if any attributes are functionallyCheck if any attributes are functionally
dependent on any other nondependent on any other nondependent on any other nondependent on any other non----key attributeskey attributeskey attributeskey attributes
CourseCourseCourseCourse----type is transitively dependent ontype is transitively dependent ontype is transitively dependent ontype is transitively dependent onCourseCourseCourseCourse----code because, if Coursecode because, if Coursecode because, if Coursecode because, if Course----codecodecodecodechanges, so will Coursechanges, so will Coursechanges, so will Coursechanges, so will Course----typetypetypetype
Student (Student (Student (Student (StudentStudentStudentStudent----numnumnumnum, Course, Course, Course, Course----code, Coursecode, Coursecode, Coursecode, Course----type, Enroltype, Enroltype, Enroltype, Enrol----date, Finishdate, Finishdate, Finishdate, Finish----date, Graduatedate, Graduatedate, Graduatedate, Graduate----date,date,date,date,TermTermTermTerm----address, Homeaddress, Homeaddress, Homeaddress, Home----address, Enrolmentaddress, Enrolmentaddress, Enrolmentaddress, Enrolment----type)type)type)type)
22 July, 2010 2. 36ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
2NF to 3NF Process2NF to 3NF Process2NF to 3NF Process2NF to 3NF ProcessStudent becomes:Student becomes:Student becomes:Student becomes:
Student (Student (Student (Student (StudentStudentStudentStudent----numnumnumnum, Course, Course, Course, Course----code, Enrolcode, Enrolcode, Enrolcode, Enrol----date, Finishdate, Finishdate, Finishdate, Finish----date, Graduatedate, Graduatedate, Graduatedate, Graduate----date, Termdate, Termdate, Termdate, Term----address, Homeaddress, Homeaddress, Homeaddress, Home----address, Enrolmentaddress, Enrolmentaddress, Enrolmentaddress, Enrolment----type)type)type)type)
Plus:Plus:Plus:Plus:
Course (Course (Course (Course (CourseCourseCourseCourse----codecodecodecode, Course, Course, Course, Course----type)type)type)type)
Both in third normal form (3NF) Note thatBoth in third normal form (3NF) Note thatBoth in third normal form (3NF) Note thatBoth in third normal form (3NF) Note thatCourseCourseCourseCourse----code remains in Student. Nevercode remains in Student. Nevercode remains in Student. Nevercode remains in Student. Neverdelete a key.delete a key.delete a key.delete a key.
8/2/2019 02 ICT118 SQL ERD Normal is at Ion Sem 2 2010
13/13
22/07/2010
13
22 July, 2010 2. 37ICT118 Database and Information Management, Sem 2, 2010.Includes some Cengage material
Final Result of NormalisationFinal Result of NormalisationFinal Result of NormalisationFinal Result of NormalisationStudent (Student (Student (Student (StudentStudentStudentStudent----numnumnumnum, Course, Course, Course, Course----code, Enrolcode, Enrolcode, Enrolcode, Enrol----
date, Finishdate, Finishdate, Finishdate, Finish----date, Graduatedate, Graduatedate, Graduatedate, Graduate----date, Termdate, Termdate, Termdate, Term----address, Homeaddress, Homeaddress, Homeaddress, Home----address, Enrolmentaddress, Enrolmentaddress, Enrolmentaddress, Enrolment----type)type)type)type)
Course (Course (Course (Course (CourseCourseCourseCourse----codecodecodecode, Course, Course, Course, Course----type)type)type)type)
Enrolment (Enrolment (Enrolment (Enrolment (StudentStudentStudentStudent----numnumnumnum,,,, SubjectSubjectSubjectSubject----codecodecodecode, year,, year,, year,, year,score, grade)score, grade)score, grade)score, grade)
Subject (Subject (Subject (Subject (SubjectSubjectSubjectSubject----codecodecodecode, subject, subject, subject, subject----name,name,name,name,semester)semester)semester)semester)
All in third normal form (3NF)All in third normal form (3NF)All in third normal form (3NF)All in third normal form (3NF)