Course on Database Design Carlo Batini University of Milano Bicocca Part 5 Logical Design

Size: px
Start display at page:

Download "Course on Database Design Carlo Batini University of Milano Bicocca Part 5 Logical Design"

Transcription

1 Course on Database Design Carlo atini University of Milano icocca Part 5 Logical Design 1

2 Carlo atini, 2015 This work is licensed under the Creative Commons Attribution NonCommercial NoDerivatives 4.0 International License. To view a copy of this license, visit nd/4.0/. 2

3 Part 5 Lesson 1 Introduction to Logical Design This is the last part of the course, in which we apply all the topics learnt so far, with the goal of introducing a design methodology for the logical design of a database. So far, we have investigated two models, the ER model adopted in the first phase of database design, conceptual design, and the relational model, adopted in logical design. The output of conceptual design is a conceptual schema, that in logical design has to be transformed into an equivalent representation in the relational model, the relational logical schema. High level conceptual map Part 1 - asic Concepts Data Information Organizational System and Information System asic Structure of a Computer Traditional Data Management Redundancy Inconsistency Data ase - 1 Data ase Model Relational Model Relation Attribute Data ase 2 Schema Instance Data ase Technology Data ase Management System SQL-Data Description Language SQL-Data Manipulation Language Data ase Design Design Phase Conceptual Design Entity Relationship Model Logical Design Set up, Query and Update Phase Methodology Part 2 - Entity Relationship Model Diagrammatic Representation Modeling Construct Entity Attribute of Entity Relationship Attribute of Relationship Min/Max Cardinality of an Entity in a Relat. Is-a Relationship between two Entities Generalization Hierarchy among n Entities Inheritance Property Identifier of an Entity Internal Identifier External Identifier Part 3 - Relational Model Relation Schema Instance Tuple Attribute Domain of an Attribute Value of an Attribute Data ase Schema Instance Incomplete information Integrity Constraint Intra Relation Int. Constraint Domain Constraint Tuple Constraint Key Primary Key Inter Relation Int. Constraint Referential Integrity Rel. Data ase Quality: Normalization oyce Codd Normal Form Normalization Process Part 4 - Conceptual Design Schema Quality Dimension Correctness with respect to the Model Correctness with respect to Requirements Minimality (Redundancy) Completeness Pertinence Readability Diagrammatic Readability Compactness Normalization Design Strategy ottom Up Top Down Oil Stain Mixed Part 5 - Logical Design Phase of Logical Design Simplification and Optimization Translation Simplification Phase Removing Generalizations Optimization Phase Partitoning of Entities/Relationships Merging of Entities/Relationships Translation Step (Translation of an) Entity Many to Many Relationship One to Many Relationship Ternary Relationship Recursive Relationship (1,1) to (1,1) Relationship to (1,1) Relationship to Relationship Low level conceptual map In order to translate the conceptual schema into the logical schema we have to define correspondences between constructs of the ER model and constructs of the logical model. Tables and attributes of the relational schema will be used as operands by queries and transactions of the application load; as a 3

4 consequence, the process of translation has to be performed with the objective to optimize the use of resources by queries and transactions. Resources to be optimized are of two types, a. space occupied by intermediate results in query execution (we do not consider transactions in the following, as usually queries are responsible of more relevant transfers) and b. time needed to execute the query. Other optimizations are characteristic of the physical schema, that defines the physical representation of data in secondary memory, such as e.g. the sectors in secondary memory where tables are stored, or the so called block factor, the minimum number of bits that are transferred each time from secondary memory to main memory, and viceversa. The optimization parameters of the physical schema are a high number, and in this course we will not deal at all with the many issues that arise in the optimal design of the physical schema. The topics is discussed in some detail in the Atzeni s book. We now provide an introduction to main issues to be addressed in logical design. First of all, we provide an input output view of logical design in general, see the following figure. Conceptual schema Queries Logical design Application load Logical model Transactions Logical schema Logical design as a black box The figure tell us that logical design is an activity of transformation of the conceptual schema into the logical schema. The logical schema is expressed in terms of the logical model adopted. Furthermore, among the different equivalent schemas that we may produce, we have to choose the schema that optimizes the application load; the application load is made of the queries performed on the database (as I said, we omit transactions), ranked according to their frequencies. We assume that the model for the logical schema is the relational model, so the input output view is simplified as in the following figure. Conceptual schema Logical design Query load Relational model Relational schema Logical design in the relational model In this part of the course, we introduce a simplified graphical notation for ER diagrams. We define the notation using an example. In the following figure we see an ER diagram adopting the notation introduced in Part 2. 4

5 Surname Student Exam Course Date Grade Chinese Student Foreing Student Country Diagrammatic notation for ER diagrams adopted so far The corresponding diagram adopting the simplified notation is shown in the following figure. Identifier of Entity Student Id Surname Student Exam Grade Date Course Course Id Attributes of Relationship Attribute of Entity Chinese Student Foreing Student Country Simplified notation adopted in this chapter Entities, relationships, is a hierarchies, generalizations and external identifiers adopt the same notation as in Part 2. The novelty is represented by attributes, that are listed close to the corresponding entity or relationship. When the internal identifier is an attribute, it is underlined. The above schema is now adopted for the motivating example, that will allow us to introduce the relevant issues of logical design. The logical design process will be performed in the example within the following two assumptions. 1. The relational model has only one modeling construct, the relation or table, composed of attributes. The many examples of correspondence we have seen between constructs of the ER model and the relation construct have shown that we will not have any problem in defining translation rules from entities and relationships to relations. The problem arises with Is a hierarchies and generalizations, that do not have a direct counterpart in the relational model constructs. We have to manage this issue in logical design. 2. We assume that the application load is such that all queries visit together the entities Student and Course. Let us now reply to the following questions: which are the typical steps of logical design? First, we have to perform an activity of model translation from the conceptual model to the relational model. Such activity, remembering our experience in previous parts, seems relatively simple for entities and relationships. Question 5.1 Try in our example to translate entities Student and Course and relationship Exam into relations in the relational model. 5

6 Discussion on Question 5.1 I hope you have produced tables as in the following. Student is translated into a table having as key Student Id, Course into a table with key Course Id. eing Exam a relationship whose instances are pairs of instances of Student and Course, it is translated into a table with composed key Student Id + Course Id. Student Id Surname Student Exam Course Course Id Grade Student (Student Id, Surname) Exam (Student Id, Course Id, Grade) Course (Course Id, ) Translation of entities and relationships into Relational tables What appears not immediate to perform is the translation of generalizations; see the following figure. Student Id Surname Student? Chinese Student Foreing Student Country How to translate generalizations? With reference to this case, and the related case of is a hierarchies, we can manage these situations through a simplification activity, that transforms the generalization into a new ER schema that equivalently represents the generalization, but adopts only entity and relationship constructs. We see that besides translation, and before translation, we have to perform, a second step, namely simplification. Look now at the second assumption we made previously. 2.the application load is such that all queries visit together the entities Student and Course. What are the consequences of this assumption in the logical design activity? Consider the translation we performed previously, namely 6

7 Student Id Surname Student Exam Course Course Id Grade Student (Student Id, Surname) Exam (Student Id, Course Id, Grade) Course (Course Id, ) At query time, the execution of queries on the relational schemas will request that the three tables are linked together. However, remember the structure of a computer, which I reproduce in the following figure, in the part referring to central processing unit and memories. Central Processing Unit Channels 10-2 seconds Secondary Memory 10-8 /10-9 seconds Main memory Computer structure: CPU and memories To perform the linkage of tables (that, incidentally, in the query language SQL is performed with the Join operator), we have to transfer three tables from secondary memory to main memory. Intuitively, in this specific case in which all queries are performed on all the three tables, it is more efficient to transform the ER schema made of Student, Course and Exam into a unique entity, as in the following figure. Student Id Surname Student Exam Course Course Id Grade Student Course Student Id Course Id Surname Grade Transformation for achieving efficiency Notice that we have denormalized the schema, to achieve more efficiency at query time. With this choice, a unique table will be created in the translation step. The above case is called merging in the following. As a second example, consider the following entity. 7

8 Employee Employee Id Place of irth Date of irth Level Salary Taxes An entity with two groups of attributes accessed separately by queries Assume that queries in the application load operate both on the identifier, and separately on the two groups of attributes, respectively: a. Place of irth + Date of irth, and b. Level + Salary + Taxes. This assumption is reasonable, since the two groups of attributes refer to distinct properties of Employee, respectively a. personal characteristics and b. professional and economic characteristics. In this case, we can perform the opposite transformation w.r.t the previous one: we can decompose the entity Employee into two entities that equivalently represent employees but with different attributes, except the identifier that has to be reproduced for both entities. We can use the term partitioning for this type of optimization. Employee Id Level Salary Taxes Empl1 splitted Empl2 Employee Id Place of irth Date of irth An example of partitioning Therefore, we have identifies two types of optimization activities, respectively merging and partitioning. We will see soon that also the simplification activity comprises optimization decisions. Considering that optimization, as simplification, is performed on the conceptual schema, we come to the conclusion that they are to be made before the translation in the relational model. In consequence of this, logical design has the following structure, represented in the figure. 8

9 Conceptual schema in the ER model Simplification and optimization Simplified and optimized conceptual schema in the ER model Translation Relational schema The three steps of logical design efore concluding this introductory lesson we have to make two remarks, both referring to the Atzeni s book. First, with reference to optimization activities, the book adopts an optimization methodology more complex than the methodology described in the following. For instance, it considers also the transaction load, which we have discarded; furthermore, it considers for entities and relationships their volume in terms of number of instances. See the book for more detail. Secondly, the book mentions other two activities that we will not discuss in the following, and briefly mention now. The first activity is redundancy analysis. Look at the following schema. Student Id Surname # of Exams passed Student Exam Grade Date Course Course Id An ER schema with redundancies The attribute # of Exams passed, as we noticed in Part 3, when we discussed the minimality quality dimension, is redundant. It is up to logical design to decide whether to keep it in the relational schema, or else to delete it. Keeping it in the schema makes more efficient the execution of queries that involve the attribute, but forces to update the attribute when some transaction changes the instances of relationship Exam, e.g. inserting a new exam of a student. The second activity is relevant when an entity has multiple identifiers. Such activity corresponds to the choice of the identifier to be translated as primary key of a relation. See the figure. 9

10 Student Student Id Social Security Number Given Last Student (Student Id, Social Security Number, Given, Last ) Student (Student Id, Social Security Number, Given, Last ) An entity with two identifiers and the two possible choices as primary keys We will not deal further with these two activities; the interested reader can study the Atzeni s book, Chapter 7. We show in the following figure our simplification and optimization methodology compared with the methodology described in the Atzeni s book. Course Course Id 1. Redundancy analysis Exam Student Grade Date Student Id Surname # of Exams passed 2. Removing generalizations Simplification step 3. Partitioning or merging of entities Optimization step Merging Partitioning 4. In case of multiple identifiers, choice of identifier to be translated into the primary key Simplification and optimization in Atzeni s book and in this Part 5 Now we have completed the lesson. 10

11 Part 5 Lesson 2 Simplification and Optimization Steps As we said at the end of previous lesson, we discuss in the following: a. with reference to simplification, the activity of restructuring generalizations, and b. with reference to optimization, the activities of partitioning and merging. Simplification: restructuring generalizations We will discuss this issue starting from the following example, in which we have identified with a closed dashed line the part of the schema to be restructured, and have connected with relationships A D and D E respectively entities A and C in the generalization. IdA A2 A A-D D C C-E E 1 C1 The schema of the motivating example and the part on which we focus now We have three most relevant cases, shown in the following figure. Case 1 A AC C Case 2 A A C C Case 3 A C C Relevant cases of generalization restructurings 11

12 The choice among the three cases depends on the characteristics of the query load. In this sense, the simplification activity involves also optimization choices. Let us see the three cases. The first case is applied when the queries of the application load visit the three (or n, in the general case) entities all together. The second case is applied when the queries of the application load visit separately the three entities. The third case is applied when the queries of the application load visit separately the two child entities in the generalization, and do not visit the parent entity. Let us see now how the transformation has to be performed in the three cases in order to keep unchanged the information content of the schema. We have to carefully associate to the new entity (or the new entities) the properties (attributes and relationships) associated to the entities in the generalization in the original schema. Case 1 Case 1 A AC C First case of restructuring In our example, we have to perform the following transformation and assignment of properties. IdA A2 1 A C C1 A-D C-E D E IdA A2 1 C1 Type AC (0,n) A-D C-E D E Corresponding assignment of properties to new constructs in case 1 Notice that we have assigned to the unique entity AC result of the transformation, all the attributes and relationships previously assigned to A,, and C. Furthermore, we have added a new attribute Type to the entity AC. The domain of Type is [, C]; its role is to discriminate between instances of AC corresponding to instances of and to instances of C. Finally we have changed the minimum cardinality of AC in relationship C E, since the instances of C are a subset of the instances of A and we cannot be sure that all instances of A are connected with instances of E. 12

13 Case 2 Case 2 A A C C Second case of restructuring As to the second case of transformation, in our example we have to perform the following new assigniment of properties. IdA A2 1 A C C1 A-D C-E D E IdA A2 A- A-C (1,1) (1,1) 1 A C C1 A-D C-E D E Corresponding assignment of properties to new constructs in case 2 Here we connect entities and C with A, to represent the relationships between the same entity instances in each pair of entities A/ and A/C. Furthermore, since the instances of and C coincide with a subset of the instances of A, we add to and C an external identifier. Furthermore, the two minimum cardinalities of A in relationships A and A C are both 0, as some of the instances of A, as we said, are in common with and others are in common with C. Case 3 Case 3 A C C Third case of restructuring In Case 3, see above, we assign the properties of A both to and to C, and assign both to and to C their previous properties. 13

14 IdA A2 A A-D D IdA A2 1 A-D D 1 C C1 C-E E IdA A2 C1 C C-E A-D E D Corresponding assignment of properties to new constructs in case 3 In the motivating example, due to the assumption that all queries visit entities Student and Course together, we may apply Case 1, which leads to the following transformation. Student Id Surname Student Exam Grade Date Course Course Id Chinese Student Foreing Student Country Restructuring generalizations in the motivating example We have concluded the discussion of the simplification step. Optimization: partitioning Student Id Surname Type Country Student Course Course Id We reproduce here the case of entity partitioning we discussed in the introductory lesson. Exam Grade Date Employee Employee Id Place of irth Date of irth Level Salary Taxes Employee Id Level Salary Taxes Empl1 Same as Empl2 Employee Id Place of irth Date of irth Entity partitioning 14

15 esides partitioning entities, we may also partition relationships. We do not discuss further this case. Optimization: merging Merging of two entities (and the related relationship) is performed when in the query load queries visit together the two entities and the relationship. The identifier and attributes of the resulting entity depend on the type of the relationship, namely a. many to many, b. many to one and c. one to one. In the following figure, we see the three possible cases. E1 KE1 E3 many E12 many KE2 E2 E4 E12 KE1 KE2 E3 E4 E1 one E12 many E2 KE1 E3 KE2 E4 E12 KE1 KE2 E3 E4 E1 one E12 one E2 KE1 E3 KE2 E4 E12 or E12 KE1 KE2 E3 E4 KE1 KE2 E3 E4 The three cases of entity (and related relationship) merging When the relationship is many to many, the identifier of entity E12 is the union of the identifiers of the entities to be merged. The reason of this rule is that in this case the instances of the entity correspond to the many to many instances of the relationship, and so, to be identified, we need to know the identifiers of the instances of both entities E1 and E2. When the relationship is one to many, the identifier of entity E12 is the identifier of the entity on the one side, since the corresponding instance identifies also the unique instance of the entity related to it on the many side. When the relationship is one to one, we can choose either the identifier of the first entity or the identifier of the second entity. 15

16 Notice that in the case of many to many relationships, merging leads to an un normalized entity, that will generate a table non in CNF. This is a typical design decision that is performed to make query execution more efficient. While we apply denormalization during the first phase of logical design, it can be also applied on the relational schema during the subsequent phase of physical design, which we do not discuss here. In the motivating example, applying again the assumption that all queries visit entities Student and Course together, we may perform merging, obtaining as a result the following transformation. Student Id Surname Type Country Student Exam Grade Date Course Course Id Student- Exam-Course Student Id Surname Course Id Type Country Grade Date Result of merging in the motivating example 16

17 Part 5 Lesson 3 Translation Step first part In this lesson we start discussing the different cases of translation of ER constructs from the simplified ER schema to a relational schema. They are: 1. Entity with internal identifier 2. Many to many relationship 3. Many to many Ternary relationship 4. Many to many recursive relationship 5. One to many relationship 6. Entity with external identifier 7. One to one relationship; we will have to discuss three cases: a. (1,1) to (1,1) b. to (1,1) c. to. In this lesson we discuss the first five cases. I need your collaboration in defining the different translations. You are aided by the examples given so far. 1. Entity with internal identifier In the translation, we have to remember that an entity is a class of elementary instances sharing several properties of type attribute. Question 5.2 How do you translate this case? 17

18 Solution to Question 5.2 The translation of the above entity is the following relation schema. Student (Student Id, Given, Surname, Place of irth) Since in our motivating example the ER schema is made of a unique entity, we may proceed to the translation of the simplified and optimized ER schema into the relational model. Student- Exam-Course Student Id Surname Course Id Type Country Grade Date Student-Exam-Course (Student Id, Course Id, Surname,, Type, Country, Grade, Date) 2. Many to many binary relationship Applying the translation in the motivating example Student Id Given Surname Place of irth Student Exam Grade Date Course Course Id # of Hours Example considered in the translation of many to many binary relationship As in Question 5.1, we may represent the relationship Exam with a relation, whose key is the union of the identifiers of the two participating entities. This is reasonable, since the instances of Exam are pairs of instances of Student and Course. The table is completed with the possible attributes of the relationship. In our case we have for the whole above schema the following relational schema. Student (Student Id, Given, Surname, Place of irth) resulting from entity Student Exam (Student Id, Course Id, Grade, Date) resulting from relationship Exam Course (Course Id,, # of hours) resulting from entity Course. Now, we should not forget adding referential integrity constraints, which relate the attributes participating in the key of the table Exam, with the keys of the two tables associated to the two entities. 18

19 Student (Student Id, Given, Surname, Place of irth) Exam (Student Id, Course Id, Grade, Date) Course (Course Id,, # of hours) 3. Many to many ternary relationship Do not forget referential integrity constraints IdA A2 A AC1 AC2 A--C Id 1 C IdC C1 C2 C3 Translation of ternary relationship This case is a simple extension of the previous one; the only change is that now the instances of the relationship are triples made of instances of three entities, so we have a key made of three attributes for the relation corresponding to A C. Including also referential integrity constraints, we get the following schema. A (IdA,, A2) (Id, 1, 2) A--C (IdA, Id, IdC, AC1, AC2) C (IdC, AC1, AC2) Relational schema resulting from the translation of the ternary relationship and related entities 19

20 4. Many to many binary recursive relationship Example of many to many recursive relationship The many to many binary recursive relationship in the example above is defined on the entity Person, and expresses the parental relationships among a set of persons. For each pair of persons we want also to represent the type of parental relationships, e.g. child of, uncle of, etcetera. This case too is an extension of the many to many binary case considered above. In this case, the two entities involved in the relationship coincide. Therefore, the key is made of two occurrences of the same entity identifier; in the two occurrences, we have to adopt different names. Therefore, the resulting relational schema is the following. Person (Person Id, Given, Surname) Relative (Person IdA, Person Id, Type of parental relationship) Translation of many to many recursive relationship 5. Translation of one to many relationship Student Id Given Surname Place of irth Student (1,1) Country Id orn Country Continent Example of one to many relationship A one to many relationship too is a particular case of a many to many relationship, so we could translate the two entities and the relationship with three tables. However, we have to observe that due to the one to many relationship, for each instance of Student we have a unique corresponding instance of Country in the orn relationship. Therefore, a functional dependency exists between the key of Student, namely Student Id, and the key of Country, Country Id. Therefore, we can save one table, including Course Id among the attributes of table Student. We obtain the following relational schema. 20

21 Student (Student Id, Given, Surname, Place of irth, Country) Country (Country Id,, Continent) With this case, we have concluded the lesson. Translation of a one to many relationship 21

22 Part 5 Lesson 4 Translation Step second part In this lesson, we consider the last cases of translation form ER constructs to the relational model. 6. Translation of Entity with external identifier Surname Student Id Student (1,1) St-Un University City The example for translation of an entity with external identifier The external identifier means that the key of the table Student has to be extended with the identifier of the second Entity involved in the relationship. Therefore, the resulting pair of tables corresponding to the above schema is: Student (Student Id, University, Surname) University (, City) Resulting relational schema 7.1 Translation of one to one relationship: case of (1,1) to (1,1) A KA (1,1) A- (1,1) K 1 2 (1,1) to (1,1) relationship A (1,1) to (1,1) relation is a particular case of one to many relationship, so two solutions are possible. 22

23 Solution 1 A (KA,, K) (K, 1, 2) Solution 2 A (KA, ) (K, 1, 2, KA) The two solutions are equivalent. 7.2 Translation of one to one relationship: case of to (1,1) A KA A- (1,1) K 1 2 Also in this case we have the two solutions as before: Solution 1 A (KA,, K) (K, 1, 2) Solution 2 A (KA, ) (K, 1, 2, KA) Here a difference emerges in comparison to the previous case, due to cardinalities of A. Let us see in the following figure an example of instances in the two solutions. 23

24 A Solution 1 KA K ka1 a11 null K 1 2 kb1 b11 b21 A KA A (KA,, K) (K, 1, 2) ka2 a12 kb1 ka3 a13 null ka4 a14 kb2 ka5 a15 kb3 kb2 b12 b22 kb3 b13 b23 kb4 b14 b24 A- ka6 a16 kb4 (1,1) K 1 2 A Solution 2 KA ka1 a11 K 1 2 KA kb1 b11 b21 ka2 A (KA, ) (K, 1, 2, KA) ka2 ka3 ka4 a12 a13 a14 kb2 b12 b22 ka4 kb3 b13 b23 ka5 kb4 b14 b24 ka6 ka5 a15 ka6 a16 The two cases of translation in the case to (1,1) and corresponding instances We see that in Solution 1, due to the cardinality of entity A, some instances of A are not connected with instances of, and so in table A we have null values, that correspond to inefficient use of space. In solution 2, due to the (1,1) cardinalities of entity, we have no null values, since all instances of are connected to instances of A, so KA is always different from null. In consequence of this, we prefer solution Translation of one to one relationship: case of to In this case, besides the two solutions of previous cases, we have a third solution, see the figure. 24

25 A A- KA K 1 2 Solution1 A (KA, ) (K, 1, 2, KA) Solution 2 A (KA,, K) (K, 1, 2, KA) Solution 3 A (KA, ) (K, 1, 2) A- (KA, K) The three solutions for the and case The reason of introducing Solution 3 is that in this case for both entities A and we have a minimum cardinality equal to 0. So, in case we know that only a limited number of instances of A and are connected in the relationship A, then it is preferable to introduce a third table, corresponding to the A relationship, in which we represent only pairs of keys that refer to connected instances of A and. We have concluded the lesson. 25

26 Part 5 Lesson 5 Methodology for logical design The above activities related to logical design need to be organized in a methodology. What is a methodology? It is a set of activities, ordered according to a plan, with an input and an output for each activity, that, when executed together, achieve an expected goal. In our case, the goal is to design a relational schema that is coherent with initial requirements; furthermore, among the different relational schemas that can be chosen, the resulting relational schema should be efficient with respect to the application load. The methodology for logical design is shown in the following box. Methodology: Given an Entity Relationship schema S, to be translated into a Relational schema proceed as follows: 1. SIMPLIFICATION AND OPTIMIZATION Using requirements referring to the query load, simplify and optimize the ER schema, producing a schema S'. a. Transform generalizations. b. Merge/Partition entities. 2. TRANSLATION Starting from S' a. Focus first on Entities, and translate them into relations. b. Focus on Entities with external identifier, and extend the key of the corresponding Relation with the Identifier of the other entity in the relationship. c. Focus now on binary, ternary, and recursive many to many relationships; to represent them introduce a new relation. d. Focus now on one to many Relationships; to represent them, do not introduce a new Relation, but extend the relation on the "one" side. e. Finally, focus on one to one Relationships, and translate them according to the three cases: 1. (1,1) to (1,1), 2. to (1,1), 3. to. Notice that, with reference to the translation step, it is important that transformations involving entities (steps a. and b.) be performed first, to complete the generation of keys of relations associated to entities. The order among relationship transformations is not relevant: some of them create a new relation, others extend relations previously created, but they act independently from each other. We now apply the methodology to three exercises. 26

27 Exercise 5.1 Initial schema Requirements say that: 1., C, D, E are accessed by queries all together. 2. Instances of and G are millions. 3. Instances of RG are thousands. Input schema and requirements of Exercise

28 Solution to Exercise 5.1 Let us execute first the simplification and optimization step. The simplification step involves the schema in the dashed closed line. RG K 1 RA (1,1) A KA C1 C2 C D D1 D2 E E1 E2 H RAGL L KL L1 G KG G1 (0,n) RCD (0,n) Requirement 1, that says that, C, D, E are accessed by queries all together, suggests to collapse the four entities A,,C,D into a unique entity. So we obtain the following schema. RG K 1 C1 C2 D1 D2 E1 (0,n) E2 TYPE CDE RCD (0,n) RA (1,1) H A RAGL L KA KL L1 G Result of simplification in Exercise 5.1 We have no optimization transformations, since requirements do not refer explicitly to optimizations. So the final schema corresponds to the output of the simplification step. We have now to apply the translation methodology. In the following figure, we show the different parts of the schema to be transformed. 28

29 RG K 1 C1 C2 D1 D2 E1 (0,n) E2 TYPE CDE RCD (0,n) RA (1,1) H A RAGL L KA KL L1 G KG G1 Legenda entities many to many relationships one to many relationships one to one relationships At the end of the translation process, we obtain the following relational schema. RCDE (K, 1, C1, C2, D1, D2, E1, E2, TYPE) RA (KA, ) RG (KG, G1) RL (KL, L1) RCD (KC, KD) RG (K, KG) RAGL (KA, KG, KL, H) Notice that relation RG is created due to requirements 2 and 3, that lead to choose Solution 3 of the to case of translation. We have now to add referential integrity constraints to the schema. 29

30 RCDE (K, 1, C1, C2, D1, D2, E1, E2, TYPE) RA (KA, ) RG (KG, G1) RL (KL, L1) RCD (KC, KD) RG (K, KG) RAGL (KA, KG, KL, H) This is the final schema for Exercise

31 Part 5 Lesson 6 Exercise 5.2 and Exercise 5.3 on the University Database Exercise 5.2 The input schema is shown below. KA A RA D KD D1 1 C E1 E REF F1 F RFG G KG G1 G2 G3 G4 G5 EF1 Requirements are: 1. Entities and C are visited by different queries. 2. Entities D, E, and F are visited by the same queries. 3. Attributes KG, G1 and G2 and attributes KG, G3, G4, and G5 of entity G are visited by different queries. 31

32 Solution to Exercise 5.2 We have to consider requirements 1 and 2 for the simplification step and requirement 3 for the optimization step. Leading to the following choices: Simplification Requirement 1 creates a schema with entity and C separated. Requirement 2 collapses D, E, and F into a unique entity. The output of the simplification step is the schema: KA 1 KA C1 C RD RCD (0,n) E DEF KD D1 E1 F1 RFG (0,n) F G KG G1 G2 G3 G4 G5 EF1 REF Output of simplification Optimization Requirement 3 leads to partition G into two entities. The output of the optimization step is the schema: KA 1 KA C1 C RD RCD KD D1 E1 F1 (0,n) E DEF RFG1 G1 (1,1) G12 (1,1) KG1 G1 G2 KG2 RFG2 G2 G3 (0,n) G4 F G5 REF EF1 Output of optimization Translation The output of the translation step is the following relational schema: 32

33 (KA,, 1, KD) C (KA,, 1, KD) DEF (KD, D1, E1, F1, KG1, KG2) G1 ( KG1, G11, G21, KD, KG2) G2 (KG2, G3, G4, G5, KD) REF (KD1, KD2, EF1) Output of translation Notice that we have added the attribute KD to relations G1 and G2 since the minimal cardinality of entity DEF is 0 (Solution 1 of the to (1,1) case). We now add referential integrity constraints leading to the final schema. (KA,, 1, KD) C (KA,, 1, KD) DEF (KD, D1, E1, F1, KG1,KG2) G1 ( KG1, G1, G2, KD, KG2) G2 (KG2, G3, G4, G5, KD) REF (KD1, KD2, EF1) Final schema of Exercise

34 Exercise 5.3 University database logical design The final schema of conceptual design was the one in the following figure. ID Last First Year of Enrollment Student (0,n) Enrolled in Passed Course (1,1) Foreign St. Chinese St. Grade Date Teach (1,1) orn Country orn (1,1) Department elongs to (1,1) Professor First Last Continent Address Full Professor (1,1) Associate Professor Region City orn in Here we make two assumptions. 1. Queries on Students visit together Student, Foreign Student and Chinese Student. 2. Queries on Professors visit separately Full Professors and Associate Professors. 34

35 Solution to Exercise 5.3 University database logical design The two assumptions have to be considered in the simplification step. Simplification and optimization The output of the simplification step and of the optimization step is the following. Notice that now the minimum cardinality associated to the entity Student in the two orn relationships with Country and City are both 0. This is due to the fact that some students, namely foreign students, are to be linked with Countries, and other students, namely Chinese Students, are to be linked in Cities. ID Last First Year of Enrollment Student (0,n) Enrolled in Passed Course orn Country Continent Region orn City First Last Grade Date many Full Professor (1,1) orn in (1,1) Teach First Last Teach Professor (1,1) Works in Works in Department Address The result of the translation step is the schema: Student (Student Id, Last, First, Type) Course (Course Id, Year of Enrollment) Enrolled in (Student Id, Course Id) Passed (Student Id, Course Id, Grade, Date) Professor (Last, First, Type, Department ) Department (, Address) Full Professor (Last, First, City of irth) City (, Region) Foreign Student (Student Id, Country) Chinese Student (Student Id, City of irth) Country (, Continent) 35

36 The inclusion of referential integrity constraints produces the final schema. Student (Student Id, Last, First, Type) Course (Course Id, Year of Enrollment) Enrolled in (Student Id, Course Id) Passed (Student Id, Course Id, Grade, Date) Professor (Last, First, Type, Department ) Department (, Address) Full Professor (Last, First, City of irth) City (, Region) Foreign Student (Student Id, Country) Chinese Student (Student Id, City of irth) Country (, Continent) Final schema of Exercise 5.3 With this last exercise, we end the course. I kept my promise to enable you to produce ER and relational schemas from requirements characterized by significant complexity. I recall you that to achieve in an introductory course of databases a reasonable skill you have also to attend a course on database programming. est wishes for your present and future activity in data management!!!! Carlo atini 36

37 Concepts defined in Part 5 Part 5 - Logical Design Phase of Logical Design Simplification and Optimization Translation Simplification Phase Removing Generalizations Optimization Phase Partitoning of Entities/Relationships Merging of Entities/Relationships Translation Step (Translation of an) Entity Many to Many Relationship One to Many Relationship Ternary Relationship Recursive Relationship (1,1) to (1,1) Relationship to (1,1) Relationship to Relationship 37

38 Part 5 Exercise assignment Remember that a more complex method is discussed in Atzeni s book for this part. Once studied such method in Chapter 7 of the book, solve exercises from 7.1 to 7.4 of the book. Then compare your solutions with solutions provided in the course site. 38

Course on Database Design Carlo Batini University of Milano Bicocca

Course on Database Design Carlo Batini University of Milano Bicocca Course on Database Design Carlo Batini University of Milano Bicocca 1 Carlo Batini, 2015 This work is licensed under the Creative Commons Attribution NonCommercial NoDerivatives 4.0 International License.

More information

Course on Database Design Carlo Batini University of Milano Bicocca, Italy

Course on Database Design Carlo Batini University of Milano Bicocca, Italy Course on Database Design Carlo Batini University of Milano Bicocca, Italy 1 Course on Database Design The course is made of six parts: Part 0 What you will learn in this course Part 1 Introduction to

More information

Course Design Document: IS202 Data Management. Version 4.5

Course Design Document: IS202 Data Management. Version 4.5 Course Design Document: IS202 Data Management Version 4.5 Friday, October 1, 2010 Table of Content 1. Versions History... 4 2. Overview of the Data Management... 5 3. Output and Assessment Summary... 6

More information

KDI EER: The Extended ER Model

KDI EER: The Extended ER Model KDI EER: The Extended ER Model Fausto Giunchiglia and Mattia Fumagallli University of Trento 0/61 Extended Entity Relationship Model The Extended Entity-Relationship (EER) model is a conceptual (or semantic)

More information

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys Chapter 7: Data Modeling Using the Entity- Relationship (ER) Model Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

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

Entity Relationship Diagram (ERD) Dr. Moustafa Elazhary

Entity Relationship Diagram (ERD) Dr. Moustafa Elazhary Entity Relationship Diagram (ERD) Dr. Moustafa Elazhary Data Modeling Data modeling is a very vital as it is like creating a blueprint to build a house before the actual building takes place. It is built

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

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data. Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting

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

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems CS 440: Database Management Systems Chapter 7 Outline Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys Relationship

More information

DATABASE MANAGEMENT SYSTEM

DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM For COMPUTER SCIENCE DATABASE MANAGEMENT. SYSTEM SYLLABUS ER model. Relational model: relational algebra, tuple calculus, SQL. Integrity constraints, normal forms. File organization,

More information

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601 Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Database Management System Subject Code: CS 601 Multiple Choice Type Questions 1. Data structure or the data stored

More information

LAB 2 Notes. Conceptual Design ER. Logical DB Design (relational) Schema Refinement. Physical DD

LAB 2 Notes. Conceptual Design ER. Logical DB Design (relational) Schema Refinement. Physical DD LAB 2 Notes For students that were not present in the first lab TA Web page updated : http://www.cs.ucr.edu/~cs166/ Mailing list Signup: http://www.cs.ucr.edu/mailman/listinfo/cs166 The general idea of

More information

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E) THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E) 2 CHAPTER 7 OUTLINE Using High-Level, Conceptual Data Models for Database Design Entity-Relationship (ER) model Popular high-level conceptual

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

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

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2) SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay Lecture #10 Process Modelling DFD, Function Decomp (Part 2) Let us continue with the data modeling topic. So far we have seen

More information

Introduction to modeling

Introduction to modeling Introduction to modeling Relational modelling Slides for this part are based on Chapters 11 from Halpin, T. & Morgan, T. 2008, Information Modeling and Relational Databases, Second Edition (ISBN: 978-0-12-373568-3),

More information

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 7 Data Modeling with Entity Relationship Diagrams Objectives In this chapter, students will learn: The

More information

Lecture 5 STRUCTURED ANALYSIS. PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall Bühnová, Sochor, Ráček

Lecture 5 STRUCTURED ANALYSIS. PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall Bühnová, Sochor, Ráček Lecture 5 STRUCTURED ANALYSIS PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall 2015 1 Outline ² Yourdon Modern Structured Analysis (YMSA) Context diagram (CD) Data flow diagram

More information

Conceptual Design with ER Model

Conceptual Design with ER Model Conceptual Design with ER Model Lecture #2 1/24/2012 Jeff Ballard CS564, Spring 2014, Database Management Systems 1 See the Moodle page Due February 7 Groups of 2-3 people Pick a team name Homework 1 is

More information

6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14. CSE-3421M Test #1. Design

6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14. CSE-3421M Test #1. Design 6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14 CSE-3421M Test #1 Design Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2014 Answer

More information

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling COSC 304 Introduction to Database Systems Entity-Relationship Modeling Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Conceptual Database Design Conceptual database design

More information

CSE 880:Database Systems. ER Model and Relation Schemas

CSE 880:Database Systems. ER Model and Relation Schemas CSE 880:Database Systems ER Model and Relation Schemas 1 Major Steps for Database Design and Implementation 1. Requirements Collection and Analysis: Produces database requirements such as types of data,

More information

Modern Systems Analysis and Design

Modern Systems Analysis and Design Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Designing Databases Learning Objectives Concisely define each of the following key database design terms:

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

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore 560100 ) Solution Set - Test-II Sub: Database Management Systems 16MCA23 Date: 04/04/2017 Sem & Section:II Duration:

More information

The Entity Relationship Model

The Entity Relationship Model The Entity Relationship Model CPS352: Database Systems Simon Miner Gordon College Last Revised: 2/4/15 Agenda Check-in Introduction to Course Database Environment (db2) SQL Group Exercises The Entity Relationship

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

Designing a Database Schema

Designing a Database Schema Week 10: Database Design Database Design From an ER Schema to a Relational One Restructuring an ER schema Performance Analysis Analysis of Redundancies, Removing Generalizations Translation into a Relational

More information

Objectives Definition iti of terms List five properties of relations State two properties of candidate keys Define first, second, and third normal for

Objectives Definition iti of terms List five properties of relations State two properties of candidate keys Define first, second, and third normal for Chapter 5: Logical Database Design and the Relational Model Modern Database Management 9 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Heikki Topi 2009 Pearson Education, Inc. Publishing as Prentice

More information

Ian Kenny. November 28, 2017

Ian Kenny. November 28, 2017 Ian Kenny November 28, 2017 Introductory Databases Relational Algebra Introduction In this lecture we will cover Relational Algebra. Relational Algebra is the foundation upon which SQL is built and is

More information

The Entity-Relationship Model (ER Model) - Part 2

The Entity-Relationship Model (ER Model) - Part 2 Lecture 4 The Entity-Relationship Model (ER Model) - Part 2 By Michael Hahsler Based on slides for CS145 Introduction to Databases (Stanford) Lecture 4 > Section 2 What you will learn about in this section

More information

Conceptual Design. The Entity-Relationship (ER) Model

Conceptual Design. The Entity-Relationship (ER) Model Conceptual Design. The Entity-Relationship (ER) Model CS430/630 Lecture 12 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Database Design Overview Conceptual design The Entity-Relationship

More information

8) A top-to-bottom relationship among the items in a database is established by a

8) A top-to-bottom relationship among the items in a database is established by a MULTIPLE CHOICE QUESTIONS IN DBMS (unit-1 to unit-4) 1) ER model is used in phase a) conceptual database b) schema refinement c) physical refinement d) applications and security 2) The ER model is relevant

More information

Data about data is database Select correct option: True False Partially True None of the Above

Data about data is database Select correct option: True False Partially True None of the Above Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 3 Relational Model Hello everyone, we have been looking into

More information

CIS 330: Applied Database Systems. ER to Relational Relational Algebra

CIS 330: Applied Database Systems. ER to Relational Relational Algebra CIS 330: Applied Database Systems ER to Relational Relational Algebra 1 Logical DB Design: ER to Relational Entity sets to tables: ssn name Employees lot CREATE TABLE Employees (ssn CHAR(11), name CHAR(20),

More information

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute Logical database design and the relational model Objectives of logical design... Translate the conceptual design into a logical database design that can be implemented on a chosen DBMS Input: conceptual

More information

Normalisation Chapter2 Contents

Normalisation Chapter2 Contents Contents Objective... 64 Superkey & Candidate Keys... 65 Primary, Alternate and Foreign Keys... 65 Functional Dependence... 67 Using Instances... 70 Normalisation Introduction... 70 Normalisation Problems...

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2012 1 Why Study the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, etc. It is simple,

More information

Database Design. IIO30100 Tietokantojen suunnittelu. Michal Zabovsky. Presentation overview

Database Design. IIO30100 Tietokantojen suunnittelu. Michal Zabovsky. Presentation overview Database Design IIO30100 Tietokantojen suunnittelu Michal Zabovsky Department of Informatics Faculty of Management Science and Informatics University of Zilina Slovak Republic Presentation overview Software

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

elements of a relation are called tuples. Every tuple represents an entity or a relationship. Country name code population area...

elements of a relation are called tuples. Every tuple represents an entity or a relationship. Country name code population area... 2.2.1 Relations A (database) state associates each relation schema to a relation. elements of a relation are called tuples. Every tuple represents an entity or a relationship. (: Asia, area: 4.5E7) relations

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

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

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

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling COSC 304 Introduction to Database Systems Entity-Relationship Modeling Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Conceptual Database Design Conceptual database design

More information

The Relational Model

The Relational Model The Relational Model What is the Relational Model Relations Domain Constraints SQL Integrity Constraints Translating an ER diagram to the Relational Model and SQL Views A relational database consists

More information

2.2 Relational Model (RM)

2.2 Relational Model (RM) 2.2 Relational Model (RM) Relational Model by Codd (1970): mathematical foundation: set theory, only a single structural concept Relation, entity/object types and relationship types are uniformly modeled

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

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017 Applied Databases Lecture 5 ER Model, Normal Forms Sebastian Maneth University of Edinburgh - January 30 th, 2017 Outline 2 1. Entity Relationship Model 2. Normal Forms From Last Lecture 3 the Lecturer

More information

A Deeper Look at Data Modeling. Shan-Hung Wu & DataLab CS, NTHU

A Deeper Look at Data Modeling. Shan-Hung Wu & DataLab CS, NTHU A Deeper Look at Data Modeling Shan-Hung Wu & DataLab CS, NTHU Outline More about ER & Relational Models Weak Entities Inheritance Avoiding redundancy & inconsistency Functional Dependencies Normal Forms

More information

Entity-Relationship Model &

Entity-Relationship Model & Entity-Relationship Model & IST 210 Diagram Todd S. Bacastow IST 210: Organization of data 2/1/2004 1 Design Principles Setting client has (possibly vague) idea of what he/she wants. YOUR task must design

More information

2004 John Mylopoulos. The Entity-Relationship Model John Mylopoulos. The Entity-Relationship Model John Mylopoulos

2004 John Mylopoulos. The Entity-Relationship Model John Mylopoulos. The Entity-Relationship Model John Mylopoulos XVI. The Entity-Relationship Model The Entity Relationship Model The Entity-Relationship Model Entities, Relationships and Attributes Cardinalities, Identifiers and Generalization Documentation of E-R

More information

Entity-Relationship Model. From Chapter 5, Kroenke book

Entity-Relationship Model. From Chapter 5, Kroenke book Entity-Relationship Model From Chapter 5, Kroenke book Database Design Process Requirements analysis Conceptual design data model Logical design Schema refinement: Normalization Physical tuning Problem:

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

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

Topic 5: Mapping of EER Diagrams to Relations

Topic 5: Mapping of EER Diagrams to Relations Topic 5: Mapping of EER Diagrams to Relations Olaf Hartig olaf.hartig@liu.se Recall: DB Design Process 2 Running Example 3 Algorithm for Mapping from the ER Model to the Relational Model Step 1: Map Regular

More information

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Representation in Relational Model.

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Representation in Relational Model. Database Design Database Design I: The Entity-Relationship Model Chapter 5 Goal: specification of database schema Methodology: Use E-R R model to get a high-level graphical view of essential components

More information

CS 146 Database Systems

CS 146 Database Systems DBMS CS 146 Database Systems Entity-Relationship (ER) Model CS 146 1 CS 146 2 A little history Progression of Database Systems In DBMS: single instance of data maintained and accessed by different users

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

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) The Entity Relationship Model Lecture 2, January 12, 2016 Mohammad Hammoud Today Last Session: Course overview and a brief introduction on databases and database systems

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

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to

More information

14 October 2015 EECS-3421A Test #1 p. 1 of 14. EECS-3421A Test #1. Design

14 October 2015 EECS-3421A Test #1 p. 1 of 14. EECS-3421A Test #1. Design 14 October 2015 EECS-3421A Test #1 p. 1 of 14 EECS-3421A Test #1 Design Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Fall 2015 Answer the following

More information

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1 CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1 E/R: NOT IN BOOK! IMPORTANT: Follow only lecture slides for this topic! Differences

More information

Relational Model (cont d) & Entity Relational Model. Lecture 2

Relational Model (cont d) & Entity Relational Model. Lecture 2 Relational Model (cont d) & Entity Relational Model Lecture 2 Relational Database Operators Relational algebra Defines theoretical way of manipulating table contents using relational operators: SELECT

More information

ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018

ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018 ENTITY-RELATIONSHIP MODEL CS 564- Spring 2018 WHAT IS THIS LECTURE ABOUT E/R Model: entity sets, attribute relation: binary, multi-way relationship roles, attributes on relationships subclasses (ISA) weak

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

DATA MODELS FOR SEMISTRUCTURED DATA

DATA MODELS FOR SEMISTRUCTURED DATA Chapter 2 DATA MODELS FOR SEMISTRUCTURED DATA Traditionally, real world semantics are captured in a data model, and mapped to the database schema. The real world semantics are modeled as constraints and

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

The Relational Model Constraints and SQL DDL

The Relational Model Constraints and SQL DDL The Relational Model Constraints and SQL DDL Week 2-3 Weeks 2-3 MIE253-Consens 1 Schedule Week Date Lecture Topic 1 Jan 9 Introduction to Data Management 2 Jan 16 The Relational Model 3 Jan. 23 Constraints

More information

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530 Translation of ER-diagram into Relational Schema Dr. Sunnie S. Chung CIS430/530 Learning Objectives Define each of the following database terms Relation Primary key Foreign key Referential integrity Field

More information

1D D0-541 CIW v5 Database Design Specialist Version 1.7

1D D0-541 CIW v5 Database Design Specialist Version 1.7 1D0-541 CIW v5 Database Design Specialist Version 1.7 QUESTION NO: 1 With regard to databases, what is normalization? A. The process of reducing the cardinality of a relation B. The process of organizing

More information

Conceptual Modeling in ER and UML

Conceptual Modeling in ER and UML Courses B0B36DBS, A7B36DBS: Database Systems Practical Classes 01 and 02: Conceptual Modeling in ER and UML Martin Svoboda 21. and 28. 2. 2017 Faculty of Electrical Engineering, Czech Technical University

More information

The Relational Model. Chapter 3

The Relational Model. Chapter 3 The Relational Model Chapter 3 Why Study the Relational Model? Most widely used model. Systems: IBM DB2, Informix, Microsoft (Access and SQL Server), Oracle, Sybase, MySQL, etc. Legacy systems in older

More information

Chapter 2. Database Design. Database Systems p. 25/540

Chapter 2. Database Design. Database Systems p. 25/540 Chapter 2 Database Design Database Systems p. 25/540 Database Design Phases requirements analysis specification conceptual design conceptual schema logical design logical schema physical design physical

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

Why Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages

Why Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages Why Study the Relational Model? The Relational Model Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models E.G., IBM s IMS Recent competitor: object-oriented

More information

Data Modeling: Beginning and Advanced HDT825 Five Days

Data Modeling: Beginning and Advanced HDT825 Five Days Five Days Prerequisites Students should have experience designing databases. Who Should Attend This course is targeted at database designers, data modelers, database analysts, and anyone else who needs

More information

Tutorial notes on. Object relational structural patterns

Tutorial notes on. Object relational structural patterns Tutorial notes on Object relational structural patterns Dr. C. Constantinides, P.Eng. Computer Science and Software Engineering Concordia University Page 1 of 14 Exercise 1. a) Briefly describe what is

More information

XV. The Entity-Relationship Model

XV. The Entity-Relationship Model XV. The Entity-Relationship Model The Entity-Relationship Model Entities, Relationships and Attributes Cardinalities, Identifiers and Generalization Documentation of E-R Diagrams and Business Rules Acknowledgment:

More information

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Five: Data Modeling with the Entity-Relationship Model Chapter Objectives To understand the two-phase

More information

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database? DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS Complete book short Answer Question.. QUESTION 1: What is database? A database is a logically coherent collection of data with some inherent meaning, representing

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

SQL DDL. CS3 Database Systems Weeks 4-5 SQL DDL Database design. Key Constraints. Inclusion Constraints

SQL DDL. CS3 Database Systems Weeks 4-5 SQL DDL Database design. Key Constraints. Inclusion Constraints SQL DDL CS3 Database Systems Weeks 4-5 SQL DDL Database design In its simplest use, SQL s Data Definition Language (DDL) provides a name and a type for each column of a table. CREATE TABLE Hikers ( HId

More information

OBJECTIVES. How to derive a set of relations from a conceptual data model. How to validate these relations using the technique of normalization.

OBJECTIVES. How to derive a set of relations from a conceptual data model. How to validate these relations using the technique of normalization. 7.5 逻辑数据库设计 OBJECTIVES How to derive a set of relations from a conceptual data model. How to validate these relations using the technique of normalization. 2 OBJECTIVES How to validate a logical data model

More information

Step 2: Map ER Model to Tables

Step 2: Map ER Model to Tables Step 2: Map ER Model to Tables Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Dept of Computer Engineering Khon Kaen University Overview How to map a set of tables from an ER model How to

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2014 1 Why the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, MySQL, Postgres, Sqlite,

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

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1 The Relational Model Chapter 3 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc.

More information

ER Model. Objectives (2/2) Electricite Du Laos (EDL) Dr. Kanda Runapongsa Saikaew, Computer Engineering, KKU 1

ER Model. Objectives (2/2) Electricite Du Laos (EDL) Dr. Kanda Runapongsa Saikaew, Computer Engineering, KKU 1 ER Model Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Dept of Computer Engineering Khon Kaen University Objectives (1/2) Relational Data Model Terminology of relational data model How

More information

Course Notes on From Entity-Relationship Schemas to Relational Schemas

Course Notes on From Entity-Relationship Schemas to Relational Schemas Course Notes on From Entity-Relationship Schemas to Relational Schemas The chapter deals with practical database design: the construction of a relational schema from an E-R schema this stage of database

More information

Multiple Choice Questions

Multiple Choice Questions Chapter 9 Structuring System Data Requirements 193 Chapter 9 Structuring System Data Requirements Multiple Choice Questions 1. Some systems developers believe that a data model is the most important part

More information

Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell

Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell Data Analysis 1 Chapter 2.1 V3.1 Copyright @ Napier University Dr Gordon Russell Entity Relationship Modelling Overview Database Analysis Life Cycle Components of an Entity Relationship Diagram What is

More information

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei CHAPTER 3 Data Modeling Using the Entity-Relationship (ER) Model Slide 1-2 Chapter Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts Entities and Attributes

More information

Top 88 Question Asked in Part I of MIS 150 EXAM #1 (Chapter 1-4, Appendix C) Exams questions gathered from old tests dating back to Fall 2000

Top 88 Question Asked in Part I of MIS 150 EXAM #1 (Chapter 1-4, Appendix C) Exams questions gathered from old tests dating back to Fall 2000 Top 88 Question Asked in Part I of MIS 150 EXAM #1 (Chapter 1-4, Appendix C) Exams questions gathered from old tests dating back to Fall 2000 1. Name one data model that emphasizes the concept of reusable

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) The Relational Model Lecture 3, January 18, 2015 Mohammad Hammoud Today Last Session: The entity relationship (ER) model Today s Session: ER model (Cont d): conceptual design

More information