Unit I. Introduction to Database. Prepared By: Prof.Sushila Aghav. Ref.Database Concepts by Korth

Size: px
Start display at page:

Download "Unit I. Introduction to Database. Prepared By: Prof.Sushila Aghav. Ref.Database Concepts by Korth"

Transcription

1 Unit I Introduction to Database Prepared By: Prof.Sushila Aghav Ref.Database Concepts by Korth

2 Contents Database Concepts Data Models & Types Relational Database-R Model(Table) ER Modeling Concepts of Normalization MySQL: DDL,DML,DCL,TCL,Select,VIEW,Index,Procedur es and Functions Ref.Database Concepts by Korth

3 Ref. Database Concepts by Korth

4 Ref.Database Concepts by Korth

5 Ref.Database Concepts by Korth

6 Ref.Database Concepts by Korth

7 Ref.Database Concepts by Korth

8 Ref.Database Concepts by Korth

9 Ref.Database Concepts by Korth

10 Ref.Database Concepts by Korth

11 Ref.Database Concepts by Korth

12 Ref.Database Concepts by Korth

13 Legacy Data Model: R Model Ref.Database Concepts by Korth

14 Ref.Database Concepts by Korth

15 Ref.Database Concepts by Korth

16 Ref.Database Concepts by Korth

17 Ref.Database Concepts by Korth

18 Ref.Database Concepts by Korth

19 Ref.Database Concepts by Korth

20 Ref.Database Concepts by Korth

21 Ref.Database Concepts by Korth

22 Ref.Database Concepts by Korth

23 Ref.Database Concepts by Korth

24 Ref.Database Concepts by Korth

25 Ref.Database Concepts by Korth

26 Ref.Database Concepts by Korth

27 Ref.Database Concepts by Korth

28 Ref.Database Concepts by Korth

29 Ref.Database Concepts by Korth

30 Entity-Relationship Model

31 A databasecan be modeled as: a collection of entities, relationship among entities. Modeling An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event, plant Entities have attributes Example: people have names and addresses An entity setis a set of entities of the same type that share the same properties. Example: set of all persons, companies, trees, holidays

32 Entity Sets instructor and student instructor_id instructor_name student-id student_name

33 Relationship Sets A relationship is an association among several entities Example: (Peltier) advisor (Einstein) student entity relationship set instructor entity A relationship setis a mathematical relation among n 2 entities, each taken from entity sets {(e 1, e 2, e n ) e 1 E 1, e 2 E 2,, e n E n } where (e 1, e 2,, e n ) is a relationship Example: (44553,22222) advisor

34 Relationship Set advisor

35 Relationship Sets (Cont.) An attribute can also be property of a relationship set. For instance, the advisor relationship set between entity sets instructor and student may have the attribute date which tracks when the student started being associated with the advisor

36 Degree of a Relationship Set binary relationship involve two entity sets (or degree two). most relationship sets in a database system are binary. Relationships between more than two entity sets are rare. Most relationships are binary. (More on this later.) Example: studentswork on research projectsunder the guidance of an instructor. relationship proj_guideis a ternary relationship between instructor, student, and project

37 Attributes An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. Example: instructor = (ID, name, street, city, salary ) course= (course_id, title, credits) Domain the set of permitted values for each attribute Attribute types: Simple and composite attributes. Single-valued and multivalued attributes Example: multivalued attribute: phone_numbers Derived attributes Can be computed from other attributes Example: age, given date_of_birth

38 Composite Attributes

39 Mapping Cardinality Constraints Express the number of entities to which another entity can be associated via a relationship set. Most useful in describing binary relationship sets. For a binary relationship set the mapping cardinality must be one of the following types: One to one One to many Many to one Many to many

40 Mapping Cardinalities One to one One to many Note: Some elements in Aand Bmay not be mapped to any elements in the other set

41 Mapping Cardinalities Many to one Many to many Note: Some elements in A and B may not be mapped to any elements in the other set

42 Keys A super keyof an entity set is a set of one or more attributes whose values uniquely determine each entity. A candidate keyof an entity set is a minimal super key ID is candidate key of instructor course_id is candidate key of course Although several candidate keys may exist, one of the candidate keys is selected to be the primary key.

43 Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. (s_id, i_id) is the super key of advisor NOTE: this means a pair of entity sets can have at most one relationship in a particular relationship set. Example: if we wish to track multiple meeting dates between a student and her advisor, we cannot assume a relationship for each meeting. We can use a multivalued attribute though Must consider the mapping cardinality of the relationship set when deciding what are the candidate keys Need to consider semantics of relationship set in selecting the primary key in case of more than one candidate key

44 Redundant Attributes Suppose we have entity sets instructor, with attributes including dept_name department and a relationship inst_dept relating instructor and department Attribute dept_namein entity instructoris redundant since there is an explicit relationship inst_dept which relates instructors to departments The attribute replicates information present in the relationship, and should be removed from instructor BUT: when converting back to tables, in some cases the attribute gets reintroduced, as we will see.

45 E-R Diagrams Rectangles represent entity sets. Diamonds represent relationship sets. Attributes listed inside entity rectangle Underline indicates primary key attributes

46 Entity With Composite, Multivalued, and Derived Attributes

47 Relationship Sets with Attributes

48 Roles Entity sets of a relationship need not be distinct Each occurrence of an entity set plays a role in the relationship The labels course_id and prereq_id are called roles.

49 Cardinality Constraints We express cardinality constraints by drawing either a directed line ( ), signifying one, or an undirected line ( ), signifying many, between the relationship set and the entity set. One-to-one relationship: A student is associated with at most one instructorvia the relationship advisor A student is associated with at most one department via stud_dept

50 One-to-One Relationship one-to-one relationship between an instructor and a student an instructor is associated with at most one student via advisor and a student is associated with at most one instructor via advisor

51 One-to-Many Relationship one-to-many relationship between an instructor and a student an instructor is associated with several (including 0) students via advisor a student is associated with at most one instructor via advisor,

52 Many-to-One Relationships In a many-to-one relationship between an instructorand a student, an instructor is associated with at most one student via advisor, and a student is associated with several (including 0) instructors via advisor

53 Many-to-Many Relationship An instructor is associated with several (possibly 0) students via advisor A student is associated with several (possibly 0) instructors via advisor

54 Participation of an Entity Set in a Relationship Set Total participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship set E.g., participation of section in sec_course is total every sectionmust have an associated course Partial participation: some entities may not participate in any relationship in the relationship set Example: participation of instructor in advisor is partial

55 Alternative Notation for Cardinality Limits Cardinality limits can also express participation constraints

56 E-RDiagram with a Ternary Relationship

57 Cardinality Constraints on Ternary Relationship We allow at most one arrow out of a ternary (or greater degree) relationship to indicate a cardinality constraint E.g., an arrow from proj_guideto instructorindicates each student has at most one guide for a project If there is more than one arrow, there are two ways of defining the meaning. E.g., a ternary relationship R between A,B and C with arrows to B and C could mean 1. each A entity is associated with a unique entity from B and C or 2. each pair of entities from (A, B) is associated with a unique C entity, and each pair (A, C) is associated with a unique B Each alternative has been used in different formalisms To avoid confusion we outlaw more than one arrow

58 How about doing an ER design interactively on the board? Suggest an application to be modeled.

59 Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the existence of a identifying entity set It must relate to the identifying entity set via a total, one-to-many relationship set from the identifying to the weak entity set Identifying relationship depicted using a double diamond The discriminator(or partial key)of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set. The primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set is existence dependent, plus the weak entity set s discriminator.

60 Weak Entity Sets (Cont.) We underline the discriminator of a weak entity set with a dashed line. We put the identifying relationship of a weak entity in a double diamond. Primary key for section (course_id, sec_id, semester, year)

61 Weak Entity Sets (Cont.) Note: the primary key of the strong entity set is not explicitly stored with the weak entity set, since it is implicit in the identifying relationship. If course_idwere explicitly stored, sectioncould be made a strong entity, but then the relationship between sectionand coursewould be duplicated by an implicit relationship defined by the attribute course_id common to course and section

62 E-R Diagram for a University Enterprise

63 Reduction to Relational Schemas

64 Reduction to Relation Schemas Entity sets and relationship sets can be expressed uniformly as relation schemas that represent the contents of the database. A database which conforms to an E-R diagram can be represented by a collection of schemas. For each entity set and relationship set there is a unique schema that is assigned the name of the corresponding entity set or relationship set. Each schema has a number of columns (generally corresponding to attributes), which have unique names.

65 Representing Entity Sets With Simple Attributes A strong entity set reduces to a schema with the same attributes student(id, name, tot_cred) A weak entity set becomes a table that includes a column for the primary key of the identifying strong entity set section ( course_id, sec_id, sem, year)

66 Representing Relationship Sets A many-to-many relationship set is represented as a schema with attributes for the primary keys of the two participating entity sets, and any descriptive attributes of the relationship set. Example: schema for relationship set advisor advisor = (s_id, i_id)

67 Redundancy of Schemas Many-to-one and one-to-many relationship sets that are total on the manyside can be represented by adding an extra attribute to the many side, containing the primary key of the one side Example: Instead of creating a schema for relationship set inst_dept, add an attribute dept_name to the schema arising from entity set instructor

68 Redundancy of Schemas (Cont.) For one-to-one relationship sets, either side can be chosen to act as the many side That is, extra attribute can be added to either of the tables corresponding to the two entity sets If participation is partialon the many side, replacing a schema by an extra attribute in the schema corresponding to the many side could result in null values The schema corresponding to a relationship set linking a weak entity set to its identifying strong entity set is redundant. Example: The section schema already contains the attributes that would appear in the sec_course schema

69 Composite and Multivalued Attributes Composite attributes are flattened out by creating a separate attribute for each component attribute Example: given entity set instructorwith composite attribute namewith component attributes first_name and last_namethe schema corresponding to the entity set has two attributes name_first_name and name_last_name Prefix omitted if there is no ambiguity Ignoring multivalued attributes, extended instructor schema is instructor(id, first_name, middle_initial, last_name, street_number, street_name, apt_number, city, state, zip_code, date_of_birth)

70 Composite and Multivalued Attributes A multivalued attribute Mof an entity Eis represented by a separate schema EM Schema EMhas attributes corresponding to the primary key of Eand an attribute corresponding to multivalued attribute M Example: Multivalued attribute phone_number of instructoris represented by a schema: inst_phone= ( ID, phone_number) Each value of the multivalued attribute maps to a separate tuple of the relation on schema EM For example, an instructorentity with primary key and phone numbers and maps to two tuples: (22222, ) and (22222, )

71 Multivalued Attributes (Cont.) Special case:entity time_slot has only one attribute other than the primarykey attribute, and that attribute is multivalued Optimization: Don t create the relation corresponding to the entity, just create the one corresponding to the multivalued attribute time_slot(time_slot_id, day, start_time, end_time) Caveat: time_slot attribute of section (from sec_time_slot) cannot be a foreign key due to this optimization

72 Design Issues Use of entity sets vs. attributes Use of phone as an entity allows extra information about phone numbers (plus multiple phone numbers)

73 Design Issues Use of entity sets vs. relationship sets Possible guideline is to designate a relationship set to describe an action that occurs between entities

74 Design Issues Binary versus n-ary relationship sets Although it is possible to replace any nonbinary (n-ary, for n> 2) relationship set by a number of distinct binary relationship sets, a n-ary relationship set shows more clearly that several entities participate in a single relationship. Placement of relationship attributes e.g., attribute date as attribute of advisor or as attribute of student

75 Binary Vs. Non-Binary Relationships Some relationships that appear to be non-binary may be better represented using binary relationships E.g., A ternary relationship parents, relating a child to his/her father and mother, is best replaced by two binary relationships, father and mother Using two binary relationships allows partial information (e.g., only mother being know) But there are some relationships that are naturally non-binary Example: proj_guide

76 Converting Non-Binary Relationships to Binary Form In general, any non-binary relationship can be represented using binary relationships by creating an artificial entity set. Replace R between entity sets A, B and Cby an entity set E, and three relationship sets: 1. R A, relating E and A 2. R B, relating E and B 3. R C, relating E and C Create a special identifying attribute for E Add any attributes of R to E For each relationship (a i, b i, c) i ) in R,create 1. a new entity e i in the entity set E 2. add (e i, a i ) to R A 3. add (e i, b i ) to R B 4. add (e i, c i ) to R C

77 Converting Non-Binary Relationships Also need to translate constraints (Cont.) Translating all constraints may not be possible There may be instances in the translated schema that cannot correspond to any instance of R Exercise: add constraints to the relationships R A, R B and R C to ensure that a newly created entity corresponds to exactly one entity in each of entity sets A, Band C We can avoid creating an identifying attribute by making E a weak entity set (described shortly) identified by the three relationship sets

78 Extended ER Features

79 Extended E-R Features: Specialization Top-down design process; we designate subgroupings within an entity set that are distinctive from other entities in the set. These subgroupings become lower-level entity sets that have attributes or participate in relationships that do not apply to the higher-level entity set. Depicted by a triangle component labeled ISA (E.g., instructor is a person). Attribute inheritance a lower-level entity set inherits all the attributes and relationship participation of the higher-level entity set to which it is linked.

80 Specialization Example

81 Extended ER Features: Generalization A bottom-up design process combine a number of entity sets that share the same features into a higher-level entity set. Specialization and generalization are simple inversions of each other; they are represented in an E-R diagram in the same way. The terms specialization and generalization are used interchangeably.

82 Specialization and Generalization (Cont.) Can have multiple specializations of an entity set based on different features. E.g., permanent_employeevs. temporary_employee, in addition to instructor vs. secretary Each particular employee would be a member of one of permanent_employeeor temporary_employee, and also a member of one of instructor, secretary The ISA relationship also referred to as superclass- subclass relationship

83 Design Constraints on a Specialization/Generalization Constraint on which entities can be members of a given lower-level entity set. condition-defined Example: all customers over 65 years are members of senior-citizen entity set; senior-citizen ISA person. user-defined Constraint on whether or not entities may belong to more than one lower-level entity set within a single generalization. Disjoint an entity can belong to only one lower-level entity set Noted in E-R diagram by having multiple lower-level entity sets link to the same triangle Overlapping an entity can belong to more than one lower-level entity set

84 Design Constraints on a Specialization/Generalization (Cont.) Completeness constraint--specifies whether or not an entity in the higher-level entity set must belong to at least one of the lower-level entity sets within a generalization. total: an entity must belong to one of the lower-level entity sets partial: an entity need not belong to one of the lower-level entity sets

85 Aggregation Consider the ternary relationship proj_guide, which we saw earlier Suppose we want to record evaluations of a student by a guide on a project

86 Aggregation (Cont.) Relationship sets eval_for and proj_guiderepresent overlapping information Every eval_for relationship corresponds to a proj_guide relationship However, some proj_guiderelationships may not correspond to any eval_forrelationships So we can t discard the proj_guide relationship Eliminate this redundancy via aggregation Treat relationship as an abstract entity Allows relationships between relationships Abstraction of relationship into new entity

87 Aggregation (Cont.) Without introducing redundancy, the following diagram represents: A student is guided by a particular instructor on a particular project A student, instructor, project combination may have an associated evaluation

88 Method 1: Representing Specialization via Schemas Form a schema for the higher-level entity Form a schema for each lower-level entity set, include primary key of higher-level entity set and local attributes schema person student employee attributes ID, name, street, city ID, tot_cred ID, salary Drawback: getting information about, an employeerequires accessing two relations, the one corresponding to the low-level schema and the one corresponding to the high-level schema

89 Method 2: Representing Specialization as Schemas (Cont.) Form a schema for each entity set with all local and inherited attributes schema attributes person ID, name, street, city student ID, name, street, city, tot_cred employee ID, name, street, city, salary If specialization is total, the schema for the generalized entity set (person) not required to store information Can be defined as a view relation containing union of specialization relations But explicit schema may still be needed for foreign key constraints Drawback: name, streetand citymay be stored redundantly for people who are both students and employees

90 Schemas Corresponding to Aggregation To represent aggregation, create a schema containing primary key of the aggregated relationship, the primary key of the associated entity set any descriptive attributes

91 Schemas Corresponding to Aggregation (Cont.) For example, to represent aggregation manages between relationship works_on and entity set manager, create a schema eval_for(s_id, project_id, i_id, evaluation_id) Schema proj_guideis redundant provided we are willing to store null values for attribute manager_name in relation on schema manages

92 Normalization The purpose of normailization Data redundancy and Update Anomalies Functional Dependencies The Process of Normalization First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF)

93 Normalization Ref.Database Concepts by Korth

94 How to break schema Based on Functional Dependency and Rules Normal Forms: 1 NF,2 NF,3 NF,4 NF,5 NF,BCNF Case Study : Book Shop Ref.Database Concepts by Korth

95 The Purpose of Normalization Normalization is a technique for producing a set of relations with desirable properties, given the data requirements of an enterprise. The process of normalization is a formal method that identifies relations based on their primary or candidate keys and the functional dependencies among their attributes.

96 Update Anomalies Relations that have redundant data may have problems called update anomalies, which are classified as, Insertion anomalies Deletion anomalies Modification anomalies

97 Example of Update Anomalies To insert a new staff with branchno B007 into the StaffBranch relation; To delete a tuple that represents the last member of staff located at a branch B007; To change the address of branch B003. StaffBranch staffno sname position salary branchno baddress SL21 John White Manager B Deer Rd, London SG37 Ann Beech Assistant B Main St,Glasgow SG14 David Ford Supervisor B Main St,Glasgow SA9 Mary Howe Assistant 9000 B Argyll St, Aberdeen SG5 Susan Brand Manager B Main St,Glasgow SL41 Julie Lee Assistant 9000 B Deer Rd, London Figure 1 StraffBranch relation

98 Example of Update Anomalies (2) Staff staffno sname position salary branceno SL21 John White Manager B005 SG37 Ann Beech Assistant B003 SG14 David Ford Supervisor B003 SA9 Mary Howe Assistant 9000 B007 SG5 Susan Brand Manager B003 SL41 Julie Lee Assistant 9000 B005 Branch branceno B005 B007 B003 baddress 22 Deer Rd, London 16 Argyll St, Aberdeen 163 Main St,Glasgow Figure 2 Straff and Branch relations

99 Functional Dependencies Functional dependency describes the relationship between attributes in a relation. For example, if A and B are attributes of relation R, and B is functionally dependent on A ( denoted A B), if each value of A is associated with exactly one value of B. ( A and B may each consist of one or more attributes.) A B is functionally dependent on A B Determinant Refers to the attribute or group of attributes on the lefthand side of the arrow of a functional dependency

100 Functional Dependencies (2) Trival functional dependency means that the right-hand side is a subset ( not necessarily a proper subset) of the lefthand side. For example: (See Figure 1) staffno, sname sname staffno, sname staffno They do not provide any additional information about possible integrity constraints on the values held by these attributes. We are normally more interested in nontrivial dependenciesbecause they represent integrity constraints for the relation.

101 Functional Dependencies (3) Main characteristics of functional dependencies in normalization Have a one-to-one relationship between attribute(s) on the leftand right- hand side of a dependency; hold for all time; are nontrivial.

102 Functional Dependencies (4) Identifying the primary key Functional dependency is a property of the meaning or semantics of the attributes in a relation. When a functional dependency is present, the dependency is specified as a constraint between the attributes. An important integrity constraint to consider first is the identification of candidate keys, one of which is selected to be the primary key for the relation using functional dependency.

103 Inference Rules Functional Dependencies (5) A set of all functional dependencies that are implied by a given set of functional dependencies X is called closure of X, written X +. A set of inference rule is needed to compute X + from X. Armstrong s axioms 1. Relfexivity: If B is a subset of A, them A B 2. Augmentation: If A B, and C B then A, C B 3. Transitivity: If A B and B C, then A C 4. Self-determination: A A 5. Decomposition: If A B,C then A B and A C 6. Union: If A B and A C, then A B,C 7. Composition: If A B and C D, then A,C B,

104 Functional Dependencies (6) Minial Sets of Functional Dependencies A set of functional dependencies X is minimalif it satisfies the following condition: Every dependency in X has a single attribute on its right-hand side We cannot replace any dependency A B in X with dependency C B, where C is a proper subset of A, and still have a set of dependencies that is equivalent to X. We cannot remove any dependency from X and still have a set of dependencies that is equivalent to X.

105 Functional Dependencies (7) Example of A Minial Sets of Functional Dependencies A set of functional dependencies for the StaffBranch relation satisfies the three conditions for producing a minimal set. staffno sname staffno position staffno salary staffno branchno staffno baddress branchno baddress branchno, position salary baddress, position salary

106 The Process of Normalization Normalizationis often executed as a series of steps. Each step corresponds to a specific normal form that has known properties. As normalization proceeds, the relations become progressively more restricted in format, and also less vulnerable to update anomalies.

107 Unnormalized form (UNF) A table that contains one or more repeating groups. (1NF) Repeating group = (propertyno, paddress, rentstart, rentfinish, rent, ownerno, oname) ClientNo cname propertyno paddress rentstart rentfinish rent ownerno oname CR76 John kay PG4 PG16 PG4 6 lawrence St,Glasgow 5 Novar Dr, Glasgow 6 lawrence St,Glasgow 1-Jul Aug CO40 1-Sep-02 1-Sep-99 1-Sep Jun CO93 CO40 Tina Murphy Tony Shaw Tina Murphy CR56 Aline Stewart PG36 2 Manor Rd, Glasgow 10-Oct-00 1-Dec CO93 Tony Shaw PG16 5 Novar Dr, Glasgow 1-Nov-02 1-Aug CO93 Tony Shaw Figure 3 ClientRental unnormalized table

108 Definition of 1NF First Normal Formis a relation in which the intersection of each row and column contains one and only one value. There are two approaches to removing repeating groups from unnormalized tables: 1. Removes the repeating groups by entering appropriate data in the empty columns of rows containing the repeating data. 2. Removes the repeating group by placing the repeating data, along with a copy of the original key attribute(s), in a separate relation. A primary key is identified for the new relation.

109 With the first approach, we remove the repeating group (property rented details) by entering the appropriate client data into each row. 1NF ClientRental relation with the first approach The ClientRental relation is defined as follows, ClientRental ( clientno, propertyno, cname, paddress, rentstart, rentfinish, rent, ownerno, oname) ClientNo propertyno cname paddress rentstart rentfinish rent ownerno oname CR76 PG4 John Kay 6 lawrence St,Glasgow 1-Jul Aug CO40 Tina Murphy CR76 PG16 John Kay 5 Novar Dr, Glasgow 1-Sep-02 1-Sep CO93 Tony Shaw CR56 PG4 Aline Stewart 6 lawrence St,Glasgow 1-Sep Jun CO40 Tina Murphy CR56 PG36 Aline Stewart 2 Manor Rd, Glasgow 10-Oct-00 1-Dec CO93 Tony Shaw CR56 PG16 Aline Stewart 5 Novar Dr, Glasgow 1-Nov-02 1-Aug CO93 Tony Shaw Figure 4 1NF ClientRental relation with the first approach

110 Client (clientno, cname) PropertyRentalOwner(clientNo, propertyno, paddress, rentstart, rentfinish, rent, ownerno, oname) 1NF ClientRental relation with the second approach With the second approach, we remove the repeating group (property rented details) by placing the repeating data along with a copy of the original key attribute (clientno) in a separte relation. ClientNo CR76 CR56 cname John Kay Aline Stewart ClientNo propertyno paddress rentstart rentfinish rent ownerno oname CR76 CR76 CR56 CR56 CR56 PG4 PG16 PG4 PG36 PG16 6 lawrence St,Glasgow 5 Novar Dr, Glasgow 6 lawrence St,Glasgow 2 Manor Rd, Glasgow 5 Novar Dr, Glasgow 1-Jul Aug CO40 1-Sep-02 1-Sep CO93 1-Sep Jun CO40 10-Oct-00 1-Dec CO93 1-Nov-02 1-Aug CO93 Tina Murphy Tony Shaw Tina Murphy Tony Shaw Tony Shaw Figure 5 1NF ClientRental relation with the second approach

111 Full functional dependency Full functional dependencyindicates that if A and B are attributes of a relation, B is fully functionally dependent on A if B is functionally dependent on A, but not on any proper subset of A. A functional dependency A B is partially dependentif there is some attributes that can be removed from A and the dependency still holds.

112 Second Normal Form (2NF) Second normal form (2NF)is a relation that is in first normal form and every non-primary-key attribute is fully functionally dependent on the primary key. The normalization of 1NF relations to 2NF involves the removal of partial dependencies. If a partial dependency exists, we remove the function dependent attributes from the relation by placing them in a new relation along with a copy of their determinant.

113 2NF ClientRental relation The ClientRental relation has the following functional dependencies: fd1 clientno, propertyno rentstart, rentfinish (Primary Key) fd2 clientno cname (Partial dependency) fd3 propertyno paddress, rent, ownerno, oname (Partial dependency) fd4 ownerno oname (Transitive Dependency) fd5 clientno, rentstart propertyno, paddress, rentfinish, rent, ownerno, oname (Candidate key) fd6 propertyno, rentstart clientno, cname, rentfinish (Candidate key)

114 Client (clientno, cname) Rental (clientno, propertyno, rentstart, rentfinish) PropertyOwner (propertyno, paddress, rent, ownerno, oname) 2NF ClientRental relation After removing the partial dependencies, the creation of the three new relations called Client, Rental, and PropertyOwner Client ClientNo cname CR76 John Kay CR56 Aline Stewart PropertyOwner Rental ClientNo propertyno rentstart rentfinish CR76 PG4 1-Jul Aug-01 CR76 PG16 1-Sep-02 1-Sep-02 CR56 PG4 1-Sep Jun-00 CR56 PG36 10-Oct-00 1-Dec-01 CR56 PG16 1-Nov-02 1-Aug-03 propertyno paddress rent ownerno oname PG4 6 lawrence St,Glasgow 350 CO40 Tina Murphy PG16 5 Novar Dr, Glasgow 450 CO93 Tony Shaw PG36 2 Manor Rd, Glasgow 370 CO93 Tony Shaw Figure 6 2NF ClientRental relation

115 Third Normal Form (3NF) Transitive dependency A condition where A, B, and C are attributes of a relation such that if A B and B C, then C is transitively dependent on A via B (provided that A is not functionally dependent on B or C). Third normal form (3NF) A relation that is in first and second normal form, and in which no non-primary-key attribute is transitivelydependent on the primary key. The normalization of 2NF relations to 3NF involves the removal of transitive dependencies by placing the attribute(s) in a new relation along with a copy of the determinant.

116 3NF ClientRental relation The functional dependencies for the Client, Rentaland PropertyOwner relations are as follows: Client fd2 clientno cname (Primary Key) Rental fd1 clientno, propertyno rentstart, rentfinish (Primary Key) fd5 clientno, rentstart propertyno, rentfinish (Candidate key) fd6 propertyno, rentstart clientno, rentfinish (Candidate key) PropertyOwner fd3 propertyno paddress, rent, ownerno, oname (Primary Key) fd4 ownerno oname (Transitive Dependency)

117 3NF ClientRental relation The resulting 3NF relations have the forms: Client (clientno, cname) Rental (clientno, propertyno, rentstart, rentfinish) PropertyOwner (propertyno, paddress, rent, ownerno) Owner (ownerno, oname)

118 3NF ClientRental relation Client ClientNo CR76 CR56 cname John Kay Aline Stewart Rental ClientNo propertyno rentstart rentfinish CR76 PG4 1-Jul Aug-01 CR76 PG16 1-Sep-02 1-Sep-02 CR56 PG4 1-Sep Jun-00 CR56 PG36 10-Oct-00 1-Dec-01 CR56 PG16 1-Nov-02 1-Aug-03 PropertyOwner Owner propertyno paddress rent ownerno PG4 6 lawrence St,Glasgow 350 CO40 PG16 5 Novar Dr, Glasgow 450 CO93 PG36 2 Manor Rd, Glasgow 370 CO93 ownerno CO40 CO93 oname Tina Murphy Tony Shaw Figure 7 2NF ClientRental relation

119 Boyce-Codd Normal Form (BCNF) Boyce-Codd normal form (BCNF) A relation is in BCNF, if and only if, every determinant is a candidate key. The difference between 3NF and BCNFis that for a functional dependency A B, 3NF allows this dependency in a relation if B is a primary-key attribute and A is not a candidate key, whereas BCNF insists that for this dependency to remain in a relation, A must be a candidate key.

120 Example of BCNF fd1 clientno, interviewdate interviewtime, staffno, roomno (Primary Key) fd2 staffno, interviewdate, interviewtime clientno (Candidate key) fd3 roomno, interviewdate, interviewtime clientno, staffno (Candidate key) fd4 staffno, interviewdate roomno (not a candidate key) As a consequece the ClientInterview relation may suffer from update anmalies. For example, two tuples have to be updated if the roomno need be changed for staffno SG5 on the 13-May-02. ClientInterview ClientNo interviewdate interviewtime staffno roomno CR76 13-May SG5 G101 CR76 13-May SG5 G101 CR74 13-May SG37 G102 CR56 1-Jul SG5 G102 Figure 8 ClientInterview relation

121 Example of BCNF(2) To transform the ClientInterview relation to BCNF, we must remove the violating functional dependency by creating two new relations called Interview and SatffRoom as shown below, Interview (clientno, interviewdate, interviewtime, staffno) StaffRoom(staffNo, interviewdate, roomno) Interview ClientNo interviewdate interviewtime staffno CR76 13-May SG5 CR76 13-May SG5 CR74 13-May SG37 CR56 1-Jul SG5 StaffRoom staffno interviewdate roomno SG5 13-May-02 G101 SG37 13-May-02 G102 SG5 1-Jul-02 G102 Figure 9 BCNF Interview and StaffRoom relations

122 Fourth Normal Form (4NF) Multi-valued dependency (MVD) represents a dependency between attributes (for example, A, B and C) in a relation, such that for each value of A there is a set of values for B and a set of value for C. However, the set of values for B and C are independent of each other. A multi-valued dependency can be further defined as being trivial or nontrivial.a MVD A > B in relation R is defined as being trivial if B is a subset of A or A U B = R A MVD is defined as being nontrivial if neither of the above two conditions is satisfied.

123 Fourth Normal Form (4NF) Fourth normal form (4NF) A relation that is in Boyce-Codd normal form and contains no nontrivial multi-valued dependencies.

124 Fifth Normal Form (5NF) Fifth normal form (5NF) A relation that has no join dependency. Lossless-join dependency A property of decomposition, which ensures that no spurious tuples are generated when relations are reunited through a natural join operation. Join dependency Describes a type of dependency. For example, for a relation R with subsets of the attributes of R denoted as A, B,, Z, a relation R satisfies a join dependency if, and only if, every legal value of R is equal to the join of its projections on A, B,, Z.

125 MySQL DDL : Create, Alter,Drop,Truncate DML:Insert,update,delect DCL:grant,revoke TCL:commit,rollback Select View : Temporary Table Refer : Ref.Database Concepts by Korth

126 View A database view is known as a virtual table that allows you to query the data in it. Understanding database view and using it correctly are very important A database view allows you to simplify complex queries A database view helps limit data access to specific users. A database view provides extra security layer A database view enables computed columns CREATE VIEW view_name AS SELECT column1, column2... FROM table_name WHERE [condition]; Ref.Database Concepts by Korth

127 Index A database index is a data structure that improves the speed of operations on a table. Indexes can be created using one or more columns, providing the basis for both rapid random scan on table for data retrieval and efficient ordering of access to records. Queries based on Indexed colums gets executed faster. Practically, indexes are also type of tables, which keep primary key or index field and a pointer to each record into the actual table. Index are created for columns with primary keys, unique keys. You can use one or more columns to create an index. For example, we can create an index on tutorials_tbl using tutorial_author. Example of Explicit Unique index creation CREATE UNIQUE INDEX index_name ON table_name( column1, column2,...); Ref.Database Concepts by Korth

128 Reading. DataBaseConcepts by Korth: MySQL:: Ref.Database Concepts by Korth

Normalization. { Ronak Panchal }

Normalization. { Ronak Panchal } Normalization { Ronak Panchal } Chapter Objectives The purpose of normailization Data redundancy and Update Anomalies Functional Dependencies The Process of Normalization First Normal Form (1NF) Second

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Roadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML*

Roadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML* E-R Model (II) 1 Roadmap of This Lecture Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML* 2 Weak Entity Sets An entity set that does not have a primary key is referred

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model, 7th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity

More information

Chapter 7: Entity-Relationship Model. Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model. Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

The En'ty Rela'onship Model

The En'ty Rela'onship Model The En'ty Rela'onship Model Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Slides re-used, with minor modification, from Silberschatz, Korth and Sudarshan www.db-book.com Outline

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Chapter 2: Entity-Relationship Model

Chapter 2: Entity-Relationship Model Chapter 2: Entity-Relationship Model! Entity Sets! Relationship Sets! Design Issues! Mapping Constraints! Keys! E-R Diagram! Extended E-R Features! Design of an E-R Database Schema! Reduction of an E-R

More information

Unit1: Introduction. Database System Concepts, 6 th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use

Unit1: Introduction. Database System Concepts, 6 th Ed. Silberschatz, Korth and Sudarshan See   for conditions on re-use Unit1: Introduction Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Outline Introduction to Database Management Systems, Purpose of Database Systems, Database-System Applications,

More information

Unit I. By Prof.Sushila Aghav MIT

Unit I. By Prof.Sushila Aghav MIT Unit I By Prof.Sushila Aghav MIT Introduction The Need for Databases Data Models Relational Databases Database Design Storage Manager Query Processing Transaction Manager DBMS Applications DBMS contains

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Lecture 10 - Chapter 7 Entity Relationship Model

Lecture 10 - Chapter 7 Entity Relationship Model CMSC 461, Database Management Systems Spring 2018 Lecture 10 - Chapter 7 Entity Relationship Model These slides are based on Database System Concepts 6th edition book and are a modified version of the

More information

Chapter 3. The Relational database design

Chapter 3. The Relational database design Chapter 3 The Relational database design Chapter 3 - Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations and relations in the relational

More information

CS425 Fall 2013 Boris Glavic Chapter 7: Entity-Relationship Model!

CS425 Fall 2013 Boris Glavic Chapter 7: Entity-Relationship Model! CS425 Fall 2013 Boris Glavic Chapter 7: Entity-Relationship Model! Partially taken from! Klaus R. Dittrich! modified from:! Database System Concepts, 6 th Ed.! Silberschatz, Korth and Sudarshan See www.db-book.com

More information

Entity-Relationship Model

Entity-Relationship Model Entity-Relationship Model Data Models High-level or conceptual data models provide concepts that are close to the way many users perceive data, whereas low-level or physical data models provide concepts

More information

Other Relational Languages

Other Relational Languages Other Relational Languages 1 Tuple Relational Calculus A nonprocedural query language, where each query is of the form {t P (t ) } It is the set of all tuples t such that predicate P is true for t t is

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

DBMS Chapter Three IS304. Database Normalization-Comp.

DBMS Chapter Three IS304. Database Normalization-Comp. Database Normalization-Comp. Contents 4. Boyce Codd Normal Form (BCNF) 5. Fourth Normal Form (4NF) 6. Fifth Normal Form (5NF) 7. Sixth Normal Form (6NF) 1 4. Boyce Codd Normal Form (BCNF) In the first

More information

Chapter 2: Entity-Relationship Model. Entity Sets. Entity Sets customer and loan. Attributes. Relationship Sets. A database can be modeled as:

Chapter 2: Entity-Relationship Model. Entity Sets. Entity Sets customer and loan. Attributes. Relationship Sets. A database can be modeled as: Chapter 2: Entity-Relationship Model Entity Sets Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of an E-R Database Schema Reduction of an

More information

Database Design and the E-R Model (7.4, )

Database Design and the E-R Model (7.4, ) CSL 451 Introduction to Database Systems Database Design and the E-R Model (7.4, 7.6-7.8) Department of Computer Science and Engineering Indian Institute of Technology Ropar Narayanan (CK) Chatapuram Krishnan!

More information

ER to Relational Model. Professor Jessica Lin

ER to Relational Model. Professor Jessica Lin ER to Relational Model Professor Jessica Lin 1 Reduction to Relation Schemas Entity sets and relationship sets can be expressed uniformly as relation schemas that represent the contents of the database.

More information

Normalisation. Normalisation. Normalisation

Normalisation. Normalisation. Normalisation Normalisation Normalisation Main objective in developing a logical data model for relational database systems is to create an accurate and efficient representation of the data, its relationships, and constraints

More information

Database Technologies. Madalina CROITORU IUT Montpellier

Database Technologies. Madalina CROITORU IUT Montpellier Database Technologies Madalina CROITORU croitoru@lirmm.fr IUT Montpellier Part 5 NORMAL FORMS AND NORMALISATION Database design In the database design one can follow a bottom up approach or a top down

More information

Chapter 6: Entity-Relationship Model. E-R Diagrams

Chapter 6: Entity-Relationship Model. E-R Diagrams Chapter 6: Entity-Relationship Model A database can be modeled as: a collection of entities, relationship among entities. An entity is an object that exists and is distinguishable from other objects. Example:

More information

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 9 Normalizing Database Designs

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 9 Normalizing Database Designs Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 9 Normalizing Database Designs NORMALIZATION What is normalization? Normalization is a procedure that is

More information

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

A database can be modeled as: + a collection of entities, + a set of relationships among entities. The Relational Model Lecture 2 The Entity-Relationship Model and its Translation to the Relational Model Entity-Relationship (ER) Model + Entity Sets + Relationship Sets + Database Design Issues + Mapping

More information

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007 Lecture 14 of 42 E-R Diagrams, UML Notes: PS3 Notes, E-R Design Thursday, 15 February 2007 William H. Hsu Department of Computing and Information Sciences, KSU KSOL course page: http://snipurl.com/va60

More information

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes. Chapter 6: Entity-Relationship Model Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common data organization model The Relational

More information

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model. Chapter 6: Entity-Relationship Model The Next Step: Designing DB Schema Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common

More information

Chapter 7: Entity-Relationship Model. CS425 Fall 2016 Boris Glavic. Chapter 7: Entity-Relationship Model. Database Design.

Chapter 7: Entity-Relationship Model. CS425 Fall 2016 Boris Glavic. Chapter 7: Entity-Relationship Model. Database Design. Chapter 7: ntity-elationship Model Design Process CS425 Fall 2013 Boris Glavic Chapter 7: ntity-elationship Model Modeling Constraints - Diagram Design Issues Weak ntity Sets xtended - Features Design

More information

Chapter 14. Chapter 14 - Objectives. Purpose of Normalization. Purpose of Normalization

Chapter 14. Chapter 14 - Objectives. Purpose of Normalization. Purpose of Normalization Chapter 14 - Objectives Chapter 14 Normalization The purpose of normalization. How normalization can be used when designing a relational database. The potential problems associated with redundant data

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

6.1 RELATIONSHIP CONCEPTS

6.1 RELATIONSHIP CONCEPTS 1 SYLLABUS 6.1 Basic Entity Relationship Concepts: Entities, Relationship, Attributes 6.2 E R Diagram symbols 6.3 Conversion of Entity Relationship Model into Relations 6.4 Problems with Enitty Relationship

More information

Relational Database Design (II)

Relational Database Design (II) Relational Database Design (II) 1 Roadmap of This Lecture Algorithms for Functional Dependencies (cont d) Decomposition Using Multi-valued Dependencies More Normal Form Database-Design Process Modeling

More information

Chapter 8: Relational Database Design

Chapter 8: Relational Database Design Chapter 8: Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 8: Relational Database Design Features of Good Relational Design Atomic Domains

More information

Intro to DB CHAPTER 6

Intro to DB CHAPTER 6 Intro to DB CHAPTER 6 DATABASE DESIGN &THEER E-R MODEL Chapter 6. Entity Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of

More information

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38 Student Info StudentID: Center: ExamDate: MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: 1356458 Time: 60 min Marks: 38 BC080402322 OPKST 5/28/2010 12:00:00 AM

More information

Database Normalization

Database Normalization Database Normalization Todd Bacastow IST 210 1 Overview Introduction The Normal Forms Relationships and Referential Integrity Real World Exercise 2 Keys in the relational model Superkey A set of one or

More information

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to Relation Schemas Database Design UML A database can be modeled

More information

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables Entity-Relationship Modelling Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables 1 Entity Sets A enterprise can be modeled as a collection of: entities, and

More information

Unit 3 : Relational Database Design

Unit 3 : Relational Database Design Unit 3 : Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Content Relational Model: Basic concepts, Attributes and Domains, CODD's Rules, Relational

More information

CS317 File and Database Systems

CS317 File and Database Systems CS317 File and Database Systems http://nsa.gov1.info/utah-data-center/ http://www.google.com/about/datacenters/gallery/index.html#/locations/the-dalles/1 Lecture 8 Normalization, Bottom-Up from UNF to

More information

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam Question No: 1 ( Marks: 1 ) - Please choose one Which of the following is NOT a feature of Context DFD?

More information

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010 CS403- Database Management Systems Solved MCQS From Midterm Papers April 29,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 CS403- Database Management Systems MIDTERM EXAMINATION - Spring

More information

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise CSC 74 Database Management Systems Topic #6: Database Design Weak Entity Type E Create a relation R Include all simple attributes and simple components of composite attributes. Include the primary key

More information

COMP Instructor: Dimitris Papadias WWW page:

COMP Instructor: Dimitris Papadias WWW page: COMP 5311 Instructor: Dimitris Papadias WWW page: http://www.cse.ust.hk/~dimitris/5311/5311.html Textbook Database System Concepts, A. Silberschatz, H. Korth, and S. Sudarshan. Reference Database Management

More information

2. E-R Model. Entity Sets Relationship Sets Attributes

2. E-R Model. Entity Sets Relationship Sets Attributes 3. E R Model 2. E-R Model Entity-Relationship Model Graphical Representation of Database Equivalent to Flow-Chart in Programming It makes easy to understand Database Prior Step to implement Actual Database

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems L01: Entity Relationship (ER) Model Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR,

More information

CS317 File and Database Systems

CS317 File and Database Systems CS317 File and Database Systems http://dilbert.com/strips/comic/2010-08-24/ Lecture 8 Introduction to Normalization October 17, 2017 Sam Siewert Exam #1 Questions? Reminders Working on Grading Ex #3 -

More information

UNIT II A. ENTITY RELATIONSHIP MODEL

UNIT II A. ENTITY RELATIONSHIP MODEL UNIT II A. ENTITY RELATIONSHIP MODEL Agenda En0ty & En0ty Sets A6ributes Rela0onship & Rela0onship Sets Constraints Mapping Cardinali0es, Par0cipa0on Constraints, Keys E-R Diagrams & Design of Database

More information

FINAL EXAM REVIEW. CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27

FINAL EXAM REVIEW. CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27 FINAL EXAM REVIEW CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27 Final Exam Overview 2 Unlimited time, multiple sittings Open book, notes, MySQL database, etc. (the usual) Primary

More information

Example: specific person, company, event, plant

Example: specific person, company, event, plant A database can be modeled as: a collection of entities, relationship among entities. An entity is an object that exists and is distinguishable from other objects. Example: specific person, company, event,

More information

UNIT 3 DATABASE DESIGN

UNIT 3 DATABASE DESIGN UNIT 3 DATABASE DESIGN Objective To study design guidelines for relational databases. To know about Functional dependencies. To have an understanding on First, Second, Third Normal forms To study about

More information

Entity Relationship Modeling

Entity Relationship Modeling Chapter 12 Entity Relationship Modeling Chapter Objectives In this chapter you will learn: How to use Entity Relationship (ER) modeling in database design. The basic concepts associated with the ER model:

More information

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design 1 Normalization What and Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update Normalization uses concept of dependencies Functional

More information

Steps in normalisation. Steps in normalisation 7/15/2014

Steps in normalisation. Steps in normalisation 7/15/2014 Introduction to normalisation Normalisation Normalisation = a formal process for deciding which attributes should be grouped together in a relation Normalisation is the process of decomposing relations

More information

VARDHAMAN COLLEGE OF ENGINEERING Shamshabad , Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS

VARDHAMAN COLLEGE OF ENGINEERING Shamshabad , Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS 1 VARDHAMAN COLLEGE OF ENGINEERING Shamshabad 501 218, Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS UNIT - I INTRODUCTION: History of database systems,

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems L02: Relational Data Model Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR, China kwtleung@cse.ust.hk

More information

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant

More information

COSC Dr. Ramon Lawrence. Emp Relation

COSC Dr. Ramon Lawrence. Emp Relation COSC 304 Introduction to Database Systems Normalization Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Normalization Normalization is a technique for producing relations

More information

CSCC43H: Introduction to Databases

CSCC43H: Introduction to Databases CSCC43H: Introduction to Databases Lecture 2 Wael Aboulsaadat Acknowledgment: these slides are partially based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. CSCC43: Introduction

More information

MIS Database Systems Entity-Relationship Model.

MIS Database Systems Entity-Relationship Model. MIS 335 - Database Systems Entity-Relationship Model http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Database Design Main concepts in the ER model? ER Diagrams Database Design

More information

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.) Chapter 10 Normalization Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information in Tuples and Update Anomalies 1.3 Null

More information

CMPT 354 Database Systems I

CMPT 354 Database Systems I CMPT 354 Database Systems I Chapter 2 Entity Relationship Data Modeling Data models A data model is the specifications for designing data organization in a system. Specify database schema using a data

More information

Fundamentals of Database Systems

Fundamentals of Database Systems Fundamentals of Database Systems Assignment: 3 Due Date: 23st August, 2017 Instructions This question paper contains 15 questions in 6 pages. Q1: Consider the following relation and its functional dependencies,

More information

Relational Design: Characteristics of Well-designed DB

Relational Design: Characteristics of Well-designed DB 1. Minimal duplication Relational Design: Characteristics of Well-designed DB Consider table newfaculty (Result of F aculty T each Course) Id Lname Off Bldg Phone Salary Numb Dept Lvl MaxSz 20000 Cotts

More information

Informal Design Guidelines for Relational Databases

Informal Design Guidelines for Relational Databases Outline Informal Design Guidelines for Relational Databases Semantics of the Relation Attributes Redundant Information in Tuples and Update Anomalies Null Values in Tuples Spurious Tuples Functional Dependencies

More information

Conceptual Database Design

Conceptual Database Design Conceptual Database Design Fall 2009 Yunmook Nah Department of Electronics and Computer Engineering Dankook University Conceptual Database Design Methodology Chapter 15, Connolly & Begg Steps to Build

More information

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases Chapter 10 Functional Dependencies and Normalization for Relational Databases Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant

More information

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 ) Database Systems Lecture2:E-R model Juan Huo( 霍娟 ) Reference slides: http://www.cs.wisc.edu/ dbbook Berkeley, Professor Eben Haber,Professor Mary Roth Review: Benefits of a DBMS 1. Data independence applications

More information

Module 2 : Entity-Relationship Model 15

Module 2 : Entity-Relationship Model 15 Module 2 : Entity-Relationship Model 15 Module-02 Entity Relationship Data Model 2.1 Motivation Data modeling is an essential step in the process of creating any Database Application. It helps Database

More information

Conceptual Data Modeling

Conceptual Data Modeling Conceptual Data odeling A data model is a way to describe the structure of the data. In models that are implemented it includes a set of operations that manipulate the data. A Data odel is a combination

More information

Entity Relationship Data Model. Slides by: Shree Jaswal

Entity Relationship Data Model. Slides by: Shree Jaswal Entity Relationship Data Model Slides by: Shree Jaswal Topics: Conceptual Modeling of a database, The Entity-Relationship (ER) Model, Entity Types, Entity Sets, Attributes, and Keys, Relationship Types,

More information

0. Database Systems 1.1 Introduction to DBMS Information is one of the most valuable resources in this information age! How do we effectively and efficiently manage this information? - How does Wal-Mart

More information

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered

More information

CSCI 403: Databases 13 - Functional Dependencies and Normalization

CSCI 403: Databases 13 - Functional Dependencies and Normalization CSCI 403: Databases 13 - Functional Dependencies and Normalization Introduction The point of this lecture material is to discuss some objective measures of the goodness of a database schema. The method

More information

Redundancy:Dependencies between attributes within a relation cause redundancy.

Redundancy:Dependencies between attributes within a relation cause redundancy. Normalization Normalization: It is the process of removing redundant data from your tables in order to improve storage efficiency, data integrity and scalability. This improvement is balanced against an

More information

IS 263 Database Concepts

IS 263 Database Concepts IS 263 Database Concepts Lecture 4: Normalization Instructor: Henry Kalisti 1 Department of Computer Science and Engineering Limitations of E- R Designs Provides a set of guidelines, does not result in

More information

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra Relational Data Model and Relational Constraints Part 1 A simplified diagram to illustrate the main

More information

Database Design Theory and Normalization. CS 377: Database Systems

Database Design Theory and Normalization. CS 377: Database Systems Database Design Theory and Normalization CS 377: Database Systems Recap: What Has Been Covered Lectures 1-2: Database Overview & Concepts Lecture 4: Representational Model (Relational Model) & Mapping

More information

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys)

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys) 1 / 13 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant d Information in Tuples and Update Anomalies 1.3 Null Values in Tuples 1.4 Spurious Tuples

More information

MODULE: 3 FUNCTIONAL DEPENDENCIES

MODULE: 3 FUNCTIONAL DEPENDENCIES MODULE: 3 (13 hours) Database design: functional dependencies - Inference Rules for Functional Dependencies - Closure -- Minimal Cover -Normal forms First-second and third normal forms Boyce- Codd normal

More information

Chapter 2 ENTITY RELATIONSHIP MODEL

Chapter 2 ENTITY RELATIONSHIP MODEL INTRODUCTION Chapter 2 ENTITY RELATIONSHIP MODEL Data model is used to describe data, data relationship and constraints on data. A number of different data models have proposed. They can broadly be classified

More information

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 19 Relational Database Design (Contd.) Welcome to module

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases Slide 14-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1 Semantics of the Relation Attributes

More information

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts Chapter Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts Entities and Attributes Entity Types, Value Sets, and Key Attributes Relationships and Relationship

More information

Conceptual Data Models for Database Design

Conceptual Data Models for Database Design Conceptual Data Models for Database Design Entity Relationship (ER) Model The most popular high-level conceptual data model is the ER model. It is frequently used for the conceptual design of database

More information

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies Chapter 14 Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies Copyright 2012 Ramez Elmasri and Shamkant B. Navathe Chapter Outline 1 Informal Design Guidelines

More information

The Entity-Relationship Model. Steps in Database Design

The Entity-Relationship Model. Steps in Database Design The Entity-Relationship Model Steps in Database Design 1) Requirement Analysis Identify the data that needs to be stored data requirements Identify the operations that need to be executed on the data functional

More information

Lecture 03. Spring 2018 Borough of Manhattan Community College

Lecture 03. Spring 2018 Borough of Manhattan Community College Lecture 03 Spring 2018 Borough of Manhattan Community College 1 2 Outline 1. Brief History of the Relational Model 2. Terminology 3. Integrity Constraints 4. Views 3 History of the Relational Model The

More information

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model Modifies from: Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Textbook: Chapter 2 2.2 Example of a Relation

More information

Chapter 9: Relational DB Design byer/eer to Relational Mapping Relational Database Design Using ER-to- Relational Mapping Mapping EER Model

Chapter 9: Relational DB Design byer/eer to Relational Mapping Relational Database Design Using ER-to- Relational Mapping Mapping EER Model Chapter 9: Relational DB Design byer/eer to Relational Mapping Relational Database Design Using ER-to- Relational Mapping Mapping EER Model Constructs to Relations Relational Database Design by ER- and

More information

CSCB20 Week 2. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20 Week 2. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Week 2 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 This Week Quick Review of terminology Relational Model Continued Relational diagrams Relational operations

More information

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science 1 Distributed Database Systems Basic concepts and Definitions Data Collection of facts and figures concerning an object

More information

Database Design Process

Database Design Process Database Design Process Real World Functional Requirements Requirements Analysis Database Requirements Functional Analysis Access Specifications Application Pgm Design E-R Modeling Choice of a DBMS Data

More information

Relational Model. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Relational Model. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan Relational Model DCS COMSATS Institute of Information Technology Rab Nawaz Jadoon Assistant Professor COMSATS IIT, Abbottabad Pakistan Management Information Systems (MIS) Relational Model Relational Data

More information

Comp 5311 Database Management Systems. 2. Relational Model and Algebra

Comp 5311 Database Management Systems. 2. Relational Model and Algebra Comp 5311 Database Management Systems 2. Relational Model and Algebra 1 Basic Concepts of the Relational Model Entities and relationships of the E-R model are stored in tables also called relations (not

More information

Lecture 11 - Chapter 8 Relational Database Design Part 1

Lecture 11 - Chapter 8 Relational Database Design Part 1 CMSC 461, Database Management Systems Spring 2018 Lecture 11 - Chapter 8 Relational Database Design Part 1 These slides are based on Database System Concepts 6th edition book and are a modified version

More information