Presentation is loading. Please wait.

Presentation is loading. Please wait.

Conceptual Design and Data Modeling Chapter 2. 10/15/2015Chapter 22 of 37 Database Design Process Conceptual Design Conceptual Design Investigate business.

Similar presentations


Presentation on theme: "Conceptual Design and Data Modeling Chapter 2. 10/15/2015Chapter 22 of 37 Database Design Process Conceptual Design Conceptual Design Investigate business."— Presentation transcript:

1 Conceptual Design and Data Modeling Chapter 2

2 10/15/2015Chapter 22 of 37 Database Design Process Conceptual Design Conceptual Design Investigate business requirements and data used. Investigate business requirements and data used. How to present the data to the end user. How to present the data to the end user. Independent of hardware and software. Independent of hardware and software. Database Design Database Design Physical Design Physical Design

3 10/15/2015Chapter 23 of 37 Database Design Process Conceptual Design Conceptual Design Database Design Database Design Convert data model into tables in a relational database. Convert data model into tables in a relational database. Normalizing process. Normalizing process. Primary keys and foreign keys to connect the tables. Primary keys and foreign keys to connect the tables. Constraints implemented for attributes Constraints implemented for attributes Physical Design Physical Design

4 10/15/2015Chapter 24 of 37 Database Design Process Conceptual Design Conceptual Design Database Design Database Design Physical Design Physical Design Specify the hardware, software and physical environment. Specify the hardware, software and physical environment. Where to store the data. Where to store the data. How to import and export data. How to import and export data. Enforce security measures. Enforce security measures.

5 10/15/2015Chapter 25 of 37 Understanding the Business Process Collect the following information: Collect the following information: What works and what does not in the current business process. What works and what does not in the current business process. Goals the database will achieve. Goals the database will achieve. Type and amount of data to be stored. Type and amount of data to be stored. Business rules. Business rules. How the data will be used in the business process. How the data will be used in the business process. Implementation problems and limitations. Implementation problems and limitations.

6 10/15/2015Chapter 26 of 37 Understanding the Business Process How and where can you find the above information? How and where can you find the above information? 1. Examining the company’s documents. 2. Observe how data are transferred from one location to another. 3. Identify and interview the key players in the business process.

7 10/15/2015Chapter 27 of 37 Case Study Hillcrest Computing Business Process Hillcrest Computing Business Process Pages. 20 – 24 Pages. 20 – 24 Hillcrest Computing manufactures and sells computer products Hillcrest Computing manufactures and sells computer products It customizes computer systems based on customers’ requests. It customizes computer systems based on customers’ requests. It buys computer parts from different vendors. It buys computer parts from different vendors. It has four sales centers across the nation. It has four sales centers across the nation.

8 10/15/2015Chapter 28 of 37 Case Study At each sales center, there are about 10 employees. At each sales center, there are about 10 employees. Customer purchase orders are processed at each sales center. Customer purchase orders are processed at each sales center. Each purchase order may contain different shipping addresses. Each purchase order may contain different shipping addresses. One shipping address may also place multiple orders. One shipping address may also place multiple orders.

9 10/15/2015Chapter 29 of 37 Case Study (Sale) When a customer places an order, a purchase order form will be filled out. When a customer places an order, a purchase order form will be filled out. The form includes items such as: The form includes items such as: Type of computer system Type of computer system Order date Order date Price Price Shipping information such as customer name, address, and time Shipping information such as customer name, address, and time Sales center where the order is processed Sales center where the order is processed

10 10/15/2015Chapter 210 of 37 Case Study (Sale) When purchase orders (PO) come in, the assembly workers will assemble the computer systems. When purchase orders (PO) come in, the assembly workers will assemble the computer systems. One PO may include one or more types of computer systems. One PO may include one or more types of computer systems. Different POs may contain the same type of computer system. Different POs may contain the same type of computer system.

11 10/15/2015Chapter 211 of 37 Case Study (Assembly) To assemble a computer system, several workers will participate in an assembly process. To assemble a computer system, several workers will participate in an assembly process. Each assembly worker may assemble many computer systems, i.e., he or she may participate in many assembly processes. Each assembly worker may assemble many computer systems, i.e., he or she may participate in many assembly processes.

12 10/15/2015Chapter 212 of 37 Case Study (Assembly) In an assembly process, computer parts such as hard drives, memory, and motherboards will be put together to make a computer system based on the customer’s request. In an assembly process, computer parts such as hard drives, memory, and motherboards will be put together to make a computer system based on the customer’s request. Different computer systems may use the same kind of parts. Ex. Two computer systems with different operating systems may have the same kind of hard drive. Different computer systems may use the same kind of parts. Ex. Two computer systems with different operating systems may have the same kind of hard drive. Detailed information for each part is kept for reference. Detailed information for each part is kept for reference.

13 10/15/2015Chapter 213 of 37 Case Study (Assembly) After a computer system is assembled, the workers need to fill out a form that is used to track the products. The form includes the following items: After a computer system is assembled, the workers need to fill out a form that is used to track the products. The form includes the following items: Workers’ ID numbers and names Workers’ ID numbers and names Time used to complete the job Time used to complete the job Type of computer system assembled Type of computer system assembled Parts used for the job Parts used for the job

14 10/15/2015Chapter 214 of 37 Case Study (Accounting) The cost of a computer system will depend on the labor cost of the workers, the parts used for the computer system, and other miscellaneous costs. The cost of a computer system will depend on the labor cost of the workers, the parts used for the computer system, and other miscellaneous costs. The company needs to keep track of the information about ordering, computer system assembling, computer parts, labor costs, and shipping. The company needs to keep track of the information about ordering, computer system assembling, computer parts, labor costs, and shipping.

15 10/15/2015Chapter 215 of 37 Case Study (Accounting) The accountants will record computer system prices on purchase orders, costs of computer parts purchased from various vendors, etc. The accountants will record computer system prices on purchase orders, costs of computer parts purchased from various vendors, etc. They need to keep records of the following items: They need to keep records of the following items: Operation costs of the sales centers Operation costs of the sales centers Costs of computer parts Costs of computer parts Revenue produced at each sales center Revenue produced at each sales center Prices of computer systems sold to customers Prices of computer systems sold to customers Salaries paid to Hillcrest Computing employees Salaries paid to Hillcrest Computing employees

16 10/15/2015Chapter 216 of 37 Case Study (Personnel) Key players in the company: Key players in the company: CEO Assembly Manager Assembly Worker Accounting Manager AccountantSales ManagerSales Clerk YOU

17 10/15/2015Chapter 217 of 37 Case Study (Problem) YOU – the manager of IT – have been asked to computerized this process by designing and implementing a database for the company. YOU – the manager of IT – have been asked to computerized this process by designing and implementing a database for the company.

18 10/15/2015Chapter 218 of 37 Case Study (YOU) After talking with the key people, you have identified the goals of the database project as follows: After talking with the key people, you have identified the goals of the database project as follows: 1. Store the necessary information in a database to reduce the time to complete forms. 2. Make sure that the sales manager is informed of the assembly process. 3. Help the accounting manger collect productivity information. 4. Track market prices of computer parts and other details.

19 10/15/2015Chapter 219 of 37 Case Study (YOU) You have classified the information into the following categories: You have classified the information into the following categories: Order-Shipping System Order-Shipping System Sales center information management Sales center information management Purchase order management Purchase order management Shipping management Shipping management Inventory System Inventory System Computer parts inventory Computer parts inventory Parts detail information Parts detail information Assembly System Assembly System Assembly worker management Assembly worker management Assembly process information Assembly process information

20 10/15/2015Chapter 220 of 37 Case Study (YOU) By carefully interpreting the interview results, the database designer (YOU) comes up with a logical representation of the database structure – also called a data model. By carefully interpreting the interview results, the database designer (YOU) comes up with a logical representation of the database structure – also called a data model. This is the designer’s view of the business data. This is the designer’s view of the business data. At this point, the database designer will focus on the components of data modeling that At this point, the database designer will focus on the components of data modeling that

21 10/15/2015Chapter 221 of 37 Case Study (YOU) At this point, the database designer will focus on the components of data modeling that include: At this point, the database designer will focus on the components of data modeling that include: Entities, Entities, Attributes, Attributes, Domains, Domains, Relationships, Relationships, Business rules. Business rules.

22 10/15/2015Chapter 222 of 37 Entity-Relationship Data Model One of the most widely used modeling tool developed in the 1970’s. One of the most widely used modeling tool developed in the 1970’s. A graphical tool used to represent the logical structure of a database. A graphical tool used to represent the logical structure of a database. Keep in mind that after you have populated a database with data, it is very difficult to make changes to the structure of the database. Keep in mind that after you have populated a database with data, it is very difficult to make changes to the structure of the database.

23 10/15/2015Chapter 223 of 37 Entity An entity is a generic name for an object, such as a person, a computer, or a location that you want to keep in a database. An entity is a generic name for an object, such as a person, a computer, or a location that you want to keep in a database. Entities are things referred to as nouns. Entities are things referred to as nouns. Each worker in the assembly worker group is known as an entity instance. Each worker in the assembly worker group is known as an entity instance. A collection of entity instances is called an entity class. A collection of entity instances is called an entity class.

24 10/15/2015Chapter 224 of 37 Entity Graphically, an entity is represented by a rectangle with the entity name printed on it in capital letters. Graphically, an entity is represented by a rectangle with the entity name printed on it in capital letters. PART_DETAIL

25 10/15/2015Chapter 225 of 37 Attributes Attributes are used to describe an entity, such as a person’s name, social security number, and gender. Attributes are used to describe an entity, such as a person’s name, social security number, and gender. An instance of the entity. An instance of the entity. A composite attribute is a set of related attributes, such as an Address that consists of the Street, City, State, and Zip. A composite attribute is a set of related attributes, such as an Address that consists of the Street, City, State, and Zip. A multi-valued attribute has more than one value in it. Ex. The attribute Car may contain two values if a person has two cars. A multi-valued attribute has more than one value in it. Ex. The attribute Car may contain two values if a person has two cars.

26 10/15/2015Chapter 226 of 37 Identifiers To identify the entity instances that are workers, an identifier such as worker ID is required. To identify the entity instances that are workers, an identifier such as worker ID is required. An identifier can consist of more than one attribute. Ex. A combination of the first and last name. An identifier can consist of more than one attribute. Ex. A combination of the first and last name.

27 10/15/2015Chapter 227 of 37 Identifiers When an identifier is used to identify each individual entity instance, it is unique. When an identifier is used to identify each individual entity instance, it is unique. However, to identify groups of instances, the identifier can be non-unique because all members in the same group are identified by the same id. However, to identify groups of instances, the identifier can be non-unique because all members in the same group are identified by the same id. A unique identifier is called a key. A unique identifier is called a key. When there is no unique identifier from the attributes of an entity, a sequence of unique numbers can be used. Called a surrogate key. When there is no unique identifier from the attributes of an entity, a sequence of unique numbers can be used. Called a surrogate key.

28 10/15/2015Chapter 228 of 37 Domains The set of possible values that an attribute can use is called a domain. The set of possible values that an attribute can use is called a domain. Ex. The possible values for the attribute Gender are male or female. Ex. The possible values for the attribute Gender are male or female. The set {male, female} is the domain for the attribute. The set {male, female} is the domain for the attribute. Data types and constraints are specified in the domain of an attribute. Data types and constraints are specified in the domain of an attribute.

29 10/15/2015Chapter 229 of 37 Relationships Entities are often related to one another. Entities are often related to one another. Relationships are used to describe how entities are associated with each other. Relationships are used to describe how entities are associated with each other. Ex. Because apartments are built inside buildings, the Apartment entity is related to the Building entity. Ex. Because apartments are built inside buildings, the Apartment entity is related to the Building entity. Four major types of relationships… Four major types of relationships…

30 10/15/2015Chapter 230 of 37 1. Identifying Relationships Consider the relationship between the Apartment entity and the Building entity. Consider the relationship between the Apartment entity and the Building entity. Two apartments built in two buildings may have the same apartment number. Two apartments built in two buildings may have the same apartment number. To distinguish between these two apartments, you need to attach the building number to the apartment number. To distinguish between these two apartments, you need to attach the building number to the apartment number.

31 10/15/2015Chapter 231 of 37 1. Identifying Relationships The apartment id depends on the existence of the building id. The apartment id depends on the existence of the building id. Hence, the identifier for the Apartment entity should include the identifier for the Building entity. Hence, the identifier for the Apartment entity should include the identifier for the Building entity. Such a relationship is called an identifying relationship. Such a relationship is called an identifying relationship. The Apartment entity is the child entity. The Apartment entity is the child entity. The Building entity is the parent entity. The Building entity is the parent entity.

32 10/15/2015Chapter 232 of 37 1. Identifying Relationships Graphically, the identifying relationship is represented by a solid line. Graphically, the identifying relationship is represented by a solid line. The parent entity is represented by a rectangle. The parent entity is represented by a rectangle. The child entity is a rounded rectangle. The child entity is a rounded rectangle. A filled-in black dot placed on the side of the child means that zero, one, or many apartments may be related to a single building. A filled-in black dot placed on the side of the child means that zero, one, or many apartments may be related to a single building. In a 1:N relationship, the black dot is on the N side. In a 1:N relationship, the black dot is on the N side.

33 10/15/2015Chapter 233 of 37 1. Identifying Relationships In an identifying relationship, the key for the child entity always includes the key from the parent entity. In an identifying relationship, the key for the child entity always includes the key from the parent entity. When the key from one entity is used by another entity, it is called the foreign key and is denoted by (FK). When the key from one entity is used by another entity, it is called the foreign key and is denoted by (FK). BuildingId BuildingName SquareFootage ApartmentNumber BuildingId (FK) Type Rent BUILDINGAPARTMENT 1:N

34 10/15/2015Chapter 234 of 37 2. NonIdentifying Relationships Consider the relationship between the Advisor entity and the Student entity. Consider the relationship between the Advisor entity and the Student entity. A faculty may advise zero, one, or many students, so it is a 1:N relationship. A faculty may advise zero, one, or many students, so it is a 1:N relationship. However, each student has his or her own id, and the faculty id is not part of the key for the Student entity. However, each student has his or her own id, and the faculty id is not part of the key for the Student entity. Such a relationship is called a nonidentifying relationship. Such a relationship is called a nonidentifying relationship.

35 10/15/2015Chapter 235 of 37 2. Nonidentifying Relationships Although the entities are related by placing the advisor id in the Student entity, this time the advisor id is NOT part of the key for the Student entity. Although the entities are related by placing the advisor id in the Student entity, this time the advisor id is NOT part of the key for the Student entity. AdvisorId FirstName LastName TeachingArea StudentId FirstName LastName Major AdvisorId (FK) ADVISORSTUDENT

36 10/15/2015Chapter 236 of 37 3. Nonspecific Relationships Consider the relationship between the Student entity and the Class entity. Consider the relationship between the Student entity and the Class entity. A student may take many classes. A student may take many classes. Many students may take the same class. Many students may take the same class. Such a relationship does not have a direction from the parent entity to the child entity. Such a relationship does not have a direction from the parent entity to the child entity. This is called a nonspecific relationship, or a many-to-many (M:N) relationship. This is called a nonspecific relationship, or a many-to-many (M:N) relationship.

37 10/15/2015Chapter 237 of 37 3. Nonspecific Relationships Graphically, a nonspecific relationship is represented by a solid line with a filled-in black dot on each end. Graphically, a nonspecific relationship is represented by a solid line with a filled-in black dot on each end. Physically, it is difficult to implement such a relationship. Instead… Physically, it is difficult to implement such a relationship. Instead… Often represented by two specific 1:N relationships with an intersection entity containing only the keys from the two entities. Often represented by two specific 1:N relationships with an intersection entity containing only the keys from the two entities.

38 10/15/2015Chapter 238 of 37 3. Nonspecific Relationships ClassId ClassName Time Day Instructor ClassRoom ClassID (FK) StudentID (FK) StudentId FirstName LastName Major AdvisorId STUDENTCLASS STUDENT_CLASS

39 10/15/2015Chapter 239 of 37 4. Categorization Relationships Categorization relationship is used to represent one entity that is a specific type of another entity. Categorization relationship is used to represent one entity that is a specific type of another entity. Consider the Employee entity which includes the faculty and staff. Consider the Employee entity which includes the faculty and staff. The faculty and staff have some unshared attributes. The faculty and staff have some unshared attributes. If we place all the unshared instances in the Employee entity, the unshared attributes will contain a large number of null values. If we place all the unshared instances in the Employee entity, the unshared attributes will contain a large number of null values.

40 10/15/2015Chapter 240 of 37 4. Categorization Relationships We can placed the shared attributes into the generic entity Employee and the unshared attributes into the specific entity Professor and Staff. We can placed the shared attributes into the generic entity Employee and the unshared attributes into the specific entity Professor and Staff. Such a relationship is called a categorization relationship. Such a relationship is called a categorization relationship. The generic entity is the parent entity. The generic entity is the parent entity. The specific entities are the child entities. The specific entities are the child entities.

41 10/15/2015Chapter 241 of 37 4. Categorization Relationships An incomplete categorization is if some possible categories are not included in the relationship. An incomplete categorization is if some possible categories are not included in the relationship. A complete categorization is when every possible specific entity is included in the categorization. A complete categorization is when every possible specific entity is included in the categorization.

42 10/15/2015Chapter 242 of 37 4. Categorization Relationships EmployeeId Name Phone Number Office JobCode EmployeeId (FK) Rank TeachingArea EMPLOYEE PROFESSOR EmployeeId (FK) Position Duty STAFF Shared attributes Unshared attributes Incomplete

43 10/15/2015Chapter 243 of 37 4. Categorization Relationships EmployeeId Name Phone Number Office JobCode EmployeeId (FK) Rank TeachingArea EMPLOYEE PROFESSOR EmployeeId (FK) Position Duty STAFF Shared attributes Unshared attributes Complete EmployeeId (FK) HourlyRate WorkSchedule STUDENT_WORKDER

44 10/15/2015Chapter 244 of 37 HAS-A Relationships Two types of 1:N relationships: Two types of 1:N relationships: A HAS-A relationship associates entities of different logical types. A HAS-A relationship associates entities of different logical types. One or more attributes in the parent entity are used by the child entities. One or more attributes in the parent entity are used by the child entities. Ex. The Class and Student entities Ex. The Class and Student entities

45 10/15/2015Chapter 245 of 37 IS-A Relationships An IS-A relationship associates entities having the same logical type. An IS-A relationship associates entities having the same logical type. The child entities are the specific types of the parent entity. The child entities are the specific types of the parent entity. The parent entity contains attributes that are common to all the child entities, and each child entity contains attributes specific to itself. The parent entity contains attributes that are common to all the child entities, and each child entity contains attributes specific to itself. Ex. The Employee, Faculty, and Staff. Ex. The Employee, Faculty, and Staff.

46 10/15/2015Chapter 246 of 37 Cardinality Cardinality is the number of entity instances that can be involved in a relationship. Cardinality is the number of entity instances that can be involved in a relationship. One-or-more cardinality: P One-or-more cardinality: P Ex. Each advisor must advise at least one student. Ex. Each advisor must advise at least one student. M:N cardinality: M:N cardinality: Ex. A class can have 1 to 25 students. Ex. A class can have 1 to 25 students. Zero-or-one cardinality: Z Zero-or-one cardinality: Z Ex. An employee is either a faculty or staff Ex. An employee is either a faculty or staff

47 10/15/2015Chapter 247 of 37 Relationship Naming You can name a relationship by placing a name on the line between a parent and child. You can name a relationship by placing a name on the line between a parent and child. Name the relationship with a verb phrase from parent to child. Name the relationship with a verb phrase from parent to child.

48 10/15/2015Chapter 248 of 37 Recursive Relationships A binary relationship is when a relationship connects two entities. A binary relationship is when a relationship connects two entities. A recursive relationship is when the parent and child entities are the same entity. A recursive relationship is when the parent and child entities are the same entity. Ex. In the Student entity, you have the attribute StudentSpouse. A student’s spouse may also be a student. Ex. In the Student entity, you have the attribute StudentSpouse. A student’s spouse may also be a student.

49 10/15/2015Chapter 249 of 37 Ternary Relationship In a ternary relationship, three or more entities are involved. In a ternary relationship, three or more entities are involved. Ex. Consider the situation where there are many classes and each may have multiple sections. Ex. Consider the situation where there are many classes and each may have multiple sections. A professor teaches four class sections; each section may be taught by more than one professor. M:N relationship. A professor teaches four class sections; each section may be taught by more than one professor. M:N relationship. Each section may use more than one classroom; each classroom for many classes. M:N relationship. Each section may use more than one classroom; each classroom for many classes. M:N relationship.

50 10/15/2015Chapter 250 of 37 Business Rules Business rules are set up by companies to control business behaviors. Business rules are set up by companies to control business behaviors. A well-defined database should implement these rules. A well-defined database should implement these rules. Ex. A senior sales person have sold at least 1000 computer systems Ex. A senior sales person have sold at least 1000 computer systems

51 10/15/2015Chapter 251 of 37 Hillcrest Computing Example Goals: Goals: 1. Reduce the time to complete forms. 2. Allow the sales manager to be informed of the assembly process. 3. Help the accounting manager to collect productivity information. 4. Track market prices of computer parts.

52 10/15/2015Chapter 252 of 37 Hillcrest Computing Example Steps in developing the E-R model: Steps in developing the E-R model: 1. Identifying the entities. By examining the nouns in the business requirements. By examining the nouns in the business requirements. 2. Identifying attributes for the entities. 3. Identifying relationships among the entities. 4. Identifying cardinalities.

53 10/15/2015Chapter 253 of 37 Hillcrest Computing Example

54 10/15/2015Chapter 254 of 37 Identifying Entities The first goal is to help workers fill out the forms electronically. On the forms, one needs the information about: The first goal is to help workers fill out the forms electronically. On the forms, one needs the information about: ASSEMBLY_WORKER ASSEMBLY_WORKER ASSEMBLY_PROCESS ASSEMBLY_PROCESS COMPUTER_SYSTEM COMPUTER_SYSTEM PART PART

55 10/15/2015Chapter 255 of 37 Identifying Entities The second goal is to allow the sales manager and sales clerks to check the production progress with the following entities: The second goal is to allow the sales manager and sales clerks to check the production progress with the following entities: SALES_CENTER SALES_CENTER PURCHASE_ORDER PURCHASE_ORDER SHIPPING SHIPPING

56 10/15/2015Chapter 256 of 37 Identifying Entities The third goal requires information about costs of computer parts and assembly workers. The following entities will store information about labor cost and system cost. The third goal requires information about costs of computer parts and assembly workers. The following entities will store information about labor cost and system cost. SYSTEM_PART SYSTEM_PART SYSTEM_WORKER SYSTEM_WORKER

57 10/15/2015Chapter 257 of 37 Identifying Entities The cost of a part depends on detailed market information, so we have the entity: The cost of a part depends on detailed market information, so we have the entity: PART_DETAIL PART_DETAIL

58 10/15/2015Chapter 258 of 37 Identifying Attributes After the entities are created, we add attributes to the entities. After the entities are created, we add attributes to the entities.

59 10/15/2015Chapter 259 of 37 Hillcrest Computing Example


Download ppt "Conceptual Design and Data Modeling Chapter 2. 10/15/2015Chapter 22 of 37 Database Design Process Conceptual Design Conceptual Design Investigate business."

Similar presentations


Ads by Google