# LOGICAL DATABASE DESIGN pptx

30 127 0
Thêm vào bộ sưu tập
• Loading ...
Loading ...
Loading ...

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

## Thông tin tài liệu

Ngày đăng: 01/08/2014, 09:22

2A.1 Relational Database Desi g n L L E E S S S S O O N N : : 2 2 A A L L O O G G I I C C A A L L D D A A T T A A B B A A S S E E D D E E S S I I G G N N O O b b j j e e c c t t i i v v e e s s In this lesson, you will learn to:  Map an E/R Diagram to Tables in relation to the following: x Regular entities x Attributes x Relationships x Weak entities x Subtypes and supertypes  Identify keys  Define Specialization and Generalization 2A.2 Relational Database Desi g n Logical Database Design Lesson 2A / Slide 1 of 15©NIIT Logical Database Design Objectives In this section, you will learn to: • Map an E/R diagram to tables in relation to the following: • Regular entities • Attributes • Relationships • Weak entities • Subtypes and supertypes • Identify keys • Define Specialization and Generalization I I N N S S T T R R U U C C T T O O R R N N O O T T E E S S Lesson Overview The lesson introduces the concept of mapping E/R diagrams to tables with respect to regular entities, weak entities, relationships, attributes, subtypes, and supertypes. This lesson also contains tips for logical database design and covers the various types of keys and their applications. In addition, this lesson explains specialization and generalization of entities. 2A.3 Relational Database Desi g n Logical Database Design Lesson 2A / Slide 2 of 15©NIIT Logical Database Design Pre-assessment Questions 1. In an E/R diagram, an entity is represented as a ______. a. Diamond b. Line c. Box d. Oval 2. Which of the following denotes an association between entity types? a. Relation b. Relationship c. Relationship type d. Relation type 3. Which data model has the database structured in fixed-format records of several types? a. Relational model b. Object-based logical model c. Network model d. Hierarchical model 2A.4 Relational Database Desi g n Logical Database Design Lesson 2A / Slide 3 of 15©NIIT Logical Database Design Pre-assessment Questions (Contd ) 4. A(n) ______ is a pool of values from which one or more attributes draw their actual values. a. Relation b. Domain c. Entity d. Supertype 5. Which of the following features is essential for two tables to be union compatible? a. Attributes with same data types b. Attributes with same data c. Attributes with unique data d. Attributes with different data types 2A.5 Relational Database Desi g n Logical Database Design Lesson 2A / Slide 4 of 15©NIIT Logical Database Design Solutions Ans1. Box Ans2. Relationship type Ans3. Hierarchical model Ans4. Domain Ans5. Attributes with same data types 2A.6 Relational Database Desi g n C C O O N N C C E E P P T T U U A A L L M M O O D D E E L L Logical Database Design Lesson 2A / Slide 5 of 15©NIIT Logical Database Design Conceptual Model • The conceptual model reflects entities and their relationships based on the data-processing needs of an organization. • The conceptual model can be mapped to a relational, hierarchical, or a network model. • The conceptual model is independent of individual applications, database management systems, hardware, and physical storage of data. • Data analysis is the first step in designing a conceptual model and begins with collecting data. • Data analysis involves identifying entities, their attributes, and the relationships between entities based on the data collected. • The next step is to check all the operational and data processing uses of the organization’s data, and to eliminate any unnecessary or repeating data. • After completing data analysis, you draw the entity-relationship diagram. This diagram gives an intuitive overview of the design and is particularly good for communicating ideas to users. The conceptual model reflects entities and their relationships based on the data- processing needs of an organization. To develop a database that satisfies the information needs of the present as well as the future, you must design a conceptual model of the database first. The conceptual model design is not concerned with the implementation and operation phases of the database. The conceptual model can be mapped to a relational, hierarchical, or a network model. It is independent of individual applications, database management systems, hardware, and physical storage of data. Data analysis is the first step in designing a conceptual model, and begins with collecting information about data. This usually involves using a questionnaire or any similar method to obtain a list of data that an organization needs. Existing forms, bills, 2A.7 Relational Database Desi g n and reports are the starting points for data collection. The next step is to check all the operational and data processing uses of the organization’s data, and to eliminate any unnecessary or repeating data. Data analysis involves identifying entities, their attributes, and the relationships between entities based on the data collected. After you complete data analysis, you draw the entity-relationship diagram. This diagram gives an intuitive overview of the design, and is particularly good for communicating ideas to users. The mapping of real objects to the symbols of the entity-relationship is subjective. Often, something that was originally defined as an attribute may later, after design review iterations, become an entity. There are no stated rules to identify an object as an entity or attribute or relationship. Mapping Entity-Relationship Diagrams to Tables Logical Database Design Lesson 2A / Slide 6 of 15©NIIT Logical Database Design Mapping Entity- Relationship Diagrams to Tables • A database that conforms to an E/R diagram can be represented by a collection of tables in the relational system. • E/R diagrams can be mapped to tables in relation to the following: • Regular entities • Attributes • Relationships • Weak entities • Subtypes and supertypes A database that conforms to an E/R diagram can be represented by a collection of tables in the relational system. Let’s discuss the mapping of E/R diagrams to tables in relation to the following: Regular entities 2A.8 Relational Database Desi g n Attributes Relationships Weak entities Subtypes and supertypes Regular Entities Logical Database Design Lesson 2A / Slide 7 of 15©NIIT Logical Database Design Regular Entities • Regular entities are independent entities. • They are the “building blocks” of the database and can exist in isolation, independent of any other entity. • Each regular entity maps to a table. You will recall that regular entities are not dependent. They can exist in isolation, independent of any other entity. They are the “building blocks” of the database. Each regular entity maps to a table. For example, consider the following E/R diagram: Regular Entities STUDENT BOOKS ISSUES 2A.9 Relational Database Desi g n The regular entities STUDENT and BOOKS map to two separate tables. Attributes Logical Database Design Lesson 2A / Slide 8 of 15©NIIT Logical Database Design Attributes • Attributes are properties of entities. • Each attribute in an E/R diagram maps to an attribute in the appropriate table. Each property or attribute shown in the E/R diagram maps to an attribute in the appropriate table (refer to the figure below). Properties or attributes of STUDENT and BOOKS map to attributes in the relevant tables. STUDENT BOOKS ROLL_NO NAME ADDRESS CODE DESC PRICE 2A.10 Relational Database Desi g n Attributes The primary key in the table is identified as the key in the E/R diagram, that is, ROLL_NO and CODE. Remember that the primary key must be able to uniquely identify each tuple in the table. Relationships Logical Database Design Lesson 2A / Slide 9 of 15©NIIT Logical Database Design Relationships • The mapping of relationships depends on the type of relationship. • Each type of relationship maps to tables in a different manner in the relational database management system. • There should be a minimum number of tables with a minimum number of attributes. • A join operation retrieves all information by combining two or more tables. ROLL_NO STUDENT ISSUES PRICE NAME ADDRESS CODE DESC BOOKS [...]... Composite Some attributes may acquire further attributes to qualify themselves during database design and become entities You can create a new entity to represent important recurring groups of attributes Logical Database Design Lesson 2A / Slide 12 of 15 Relational Database Design Logical Database Design Tips on Logical Database Design (Contd ) • • • • ©NIIT Specialization is the result of taking a subset... and “H” for hourly employees HOURLY EMPLOYEE SALARIED EMPLOYEE Relational Database Design 2A.18 EMPNO WAGES OVERTIME EMPNO SALARY BONUS CONV_ ALLOW H001 - - S001 - - - H002 - - S002 - - - HOO3 - - S003 - - - Table Structure with the Coded Attribute Tips on Logical Database Design Logical Database Design Tips on Logical Database Design • • • • ©NIIT 2A.19 Do not introduce any unnecessary attributes Relational... Ask the students the following question to make them think about designing databases What according to you are the features of a good database design? Can you give some guidelines for a good database design? Then, give the tips for creating a logical database design You can give the following additional information about keys: Keys enable databases to specify how entities and relationships are distinguished... of relationships depends on the type of relationship Each type of relationship maps to tables in a different manner in the relational database management system ©NIIT Logical Database Design Relational Database Design Lesson 2A / Slide 14 of 15 2A.28 Logical Database Design Summary (Contd ) • • • • ©NIIT A weak entity is an entity whose existence depends on some other entity A subtype is a subset of... example ISSUENUM Relational Database Design 2A.14 ROLL_NO CODE ISSUE_DATE RETURN_DATE Composite Key ISSUENUM ROLL_NO CODE ISSUE_DATE RETURN_DATE Primary Key You represent the type of relationship between two entities in an entity-relationship diagram by certain symbols An entity may be associated with one, none, or many occurrences of another entity Weak Entities Logical Database Design Weak Entities •... Database Design Weak Entities • • ©NIIT 2A.15 A weak entity is an entity whose existence depends on some other entity The weak entity can be mapped to a separate table Logical Database Design Lesson 2A / Slide 10 of 15 Relational Database Design A weak entity is an entity whose existence depends on some other entity For example, the dependents of an employee Weak Entity In the above example, we have a... simplifies multiple references In generalization, every higher-level entity must also be a lowerlevel entity However, specialization does not have this constraint Logical Database Design Lesson 2A / Slide 13 of 15 Here are some tips on database design Remember that these are only guidelines Attributes Do not introduce any unnecessary attributes An attribute serves three purposes: To identify its owner... DEPENDENT that depends on the entity EMPLOYEE The DEPENDENT entity can be mapped to a separate table as follows: DEPNO EMPNO DNAME Weak Entity Mapping to a Table Relational Database Design 2A.16 Subtypes and Supertypes Logical Database Design Subtypes and Supertypes • • • • • ©NIIT A subtype is a subset of another entity A subtype is always dependent on the supertype for its existence Each entity type... Day-Scholar You can represent specialization and generalization graphically using the U-shaped symbol The top of the “U” opens to the larger or the containing set 2A.27 Relational Database Design SUMMARY Logical Database Design Summary In this lesson, you learned that: • The conceptual model reflects entities and their relationships Data analysis helps determine entities and relationships The conceptual... foreign key of the subtype It creates a link between the two The foreign key of the subtype is also its primary key Logical Database Design Lesson 2A / Slide 11 of 15 A subtype is a subset of another entity A subtype is always dependent on supertype for its existence 2A.17 Relational Database Design Subtypes and Supertypes Each entity type (subtype or supertype) maps to a separate table (see the example . the Coded Attribute Tips on Logical Database Design Logical Database Design Lesson 2A / Slide 12 of 15©NIIT Logical Database Design Tips on Logical Database Design • Do not introduce any unnecessary. Attributes with different data types 2A.5 Relational Database Desi g n Logical Database Design Lesson 2A / Slide 4 of 15©NIIT Logical Database Design Solutions Ans1. Box Ans2. Relationship type Ans3 types 2A.6 Relational Database Desi g n C C O O N N C C E E P P T T U U A A L L M M O O D D E E L L Logical Database Design Lesson 2A / Slide 5 of 15©NIIT Logical Database Design Conceptual Model • The
- Xem thêm -