32
Module 1 Designing a Conceptual Database Model

Module 1 Designing a Conceptual Database Model

  • Upload
    jacoba

  • View
    59

  • Download
    0

Embed Size (px)

DESCRIPTION

Module 1 Designing a Conceptual Database Model. Overview of Database Design Gathering Database Requirements Creating a Conceptual Database Design Overview of Entity Framework. Module Overview. Database Design Process Best Practices for Database Design - PowerPoint PPT Presentation

Citation preview

Page 1: Module 1 Designing a Conceptual Database Model

Module 1

Designing a Conceptual Database Model

Page 2: Module 1 Designing a Conceptual Database Model

• Overview of Database Design

• Gathering Database Requirements

• Creating a Conceptual Database Design

• Overview of Entity Framework

Module Overview

Page 3: Module 1 Designing a Conceptual Database Model

• Database Design Process

• Best Practices for Database Design

• Best Practices for Managing the Scope of a Database Design Project

Lesson 1: Overview of Database Design

Page 4: Module 1 Designing a Conceptual Database Model

Database Design Process

Identify and record database requirements1

Create a conceptual model2

Transform the conceptual model into a logical model3

Implement a physical model from the logical model4

Refine the physical model5

Build a prototype and test the database design6

Page 5: Module 1 Designing a Conceptual Database Model

Ensure a clear definition

of the database portion

Choose a database design methodology

Choose a professional data-modeling tool

Validate database design goals

against project scope

Begin with a conceptual model

Best Practices for Database Design

Use a source control system

Retain application features of the existing

database in the new design

Compare business needs against the ideal

design and quality

Page 6: Module 1 Designing a Conceptual Database Model

Best Practices for Managing the Scope of a Database Design Project

Obtain an authoritative statement of the project scope

Clearly identify scope boundaries

Isolate the database portion of the project scope

Ensure that the scope is realistic, feasible, and consistent

Identify the stakeholders and decision makers

Implement a change-control process

Identify database deliverables

Identify risk factors

Compile all available scoping information into a single document

Avoid scope creep

Page 7: Module 1 Designing a Conceptual Database Model

Lesson 2: Gathering Database Requirements

• Strategies for Identifying Database Requirements

• Best Practices for Documenting Database Requirements

• Considerations for Modifying an Existing Database

• Discussion: What Are the Methodologies for Maintaining a Database?

Page 8: Module 1 Designing a Conceptual Database Model

Estimate current capacity and projected growth requirements

ü

Strategies for Identifying Database Requirements

Identify and interview domain experts

ü

Establish a consistentnaming standard forbusiness objects

and rulesü

Determine the transaction rate and projected growth requirements

ü

Isolate business objects, rules, and data flows

ü

Page 9: Module 1 Designing a Conceptual Database Model

Best Practices for Documenting Database Requirements

Ensure that the database requirements are adequately represented in the requirements document

Document the requirements concisely and accurately

Clarify and revise ambiguous or unclear requirements

Make the requirements document readable for stakeholders

Obtain an explicit agreement from all stakeholders

Page 10: Module 1 Designing a Conceptual Database Model

Considerations for Modifying an Existing Database

Identify the databaserequirements related to thecurrent project

Review and validate existing database documentation

Reverse engineer the existing database design, if required

Plan for migrating the data to the new design

ü

ü ü

ü

Develop a deployment strategyü

Page 11: Module 1 Designing a Conceptual Database Model

Discussion: What Are the Methodologies for Maintaining a Database?

• How do you perform bug tracking in your organization?

• How do you implement change logs in your projects?

• What tools are used in your organization?

Page 12: Module 1 Designing a Conceptual Database Model

Lesson 3: Creating a Conceptual Database Design

• Considerations for Choosing a Conceptual Modeling Methodology

• Guidelines for Conceptual Modeling by Using ORM

• Demonstration: How To Create an ORM Diagram

• Guidelines for Conceptual Modeling by Using ER

• Demonstration: How To Create an ER Diagram

• Guidelines for Conceptual Modeling by Using UML

Page 13: Module 1 Designing a Conceptual Database Model

Considerations for Choosing a Conceptual Modeling Methodology

The data-modeling tools should support the methodology

The methodology must be acceptable to project sponsors

The methodology should support the database design at all levels

Page 14: Module 1 Designing a Conceptual Database Model

Guidelines for Conceptual Modeling by Using ORM

Identify ORM components• Identify elementary facts

• Determine fact types

• Identify types and subtypes

ü

Identify ORM roles• Determine database objects and roles

• Identify mandatory and optional rolesü

Identify ORM constraints

ü • Identify uniqueness constraints

• Identify other constraints

Page 15: Module 1 Designing a Conceptual Database Model

Demonstration: How To Create an ORM Diagram

In this demonstration, you will see how to:

Create an ORM diagram by using the ORM template

Page 16: Module 1 Designing a Conceptual Database Model

Guidelines for Conceptual Modeling by Using ER

Choose entities, attributes, and relationships based on requirementsü

Identify cardinality and constraintsü

Identify subtypes and supertypesü

Produce a conceptual ER diagramü

EntityRelationship

(ER)

StudentsPK StudentNo

FirstName

LastName

CoursePK CourseNo

CourseName

Level

Page 17: Module 1 Designing a Conceptual Database Model

Demonstration: How To Create an ER Diagram

In this demonstration, you will see how to:

Create an ER diagram by using the Database Model Diagram template

Page 18: Module 1 Designing a Conceptual Database Model

Guidelines for Conceptual Modeling by Using UML

Develop Use Case diagrams to represent

relationships

Unified Modeling Language

(UML)

CourseStudent

- StudentNo- FirstName- LastName

attends - ClassNo- ClassName- Level

Use Class diagrams to represent the conceptual model

Use Activity diagrams to build the

conceptual model

Page 19: Module 1 Designing a Conceptual Database Model

Lesson 4: Overview of Entity Framework

• Introduction to Entity Framework

• Entity Framework Components

• Selecting an Entity Data Model

• Using Entity Data Model Types

• Mapping a Conceptual Model to a Storage Schema

• Entity Data Model Relationships

• Overview of Entity Mapping

• What Is Entity SQL?

• Using Entity Data Model Tools and Stored Procedures

• Using Entity SQL Components

Page 20: Module 1 Designing a Conceptual Database Model

Introduction to Entity Framework

Entity Framework helps developers create data access applications by programming against a conceptual application model instead of programming directly against a relational storage schema

• Applications can work in terms of a more application-centric conceptual model• Applications are freed from hard-coded dependencies on a particular data engine

or storage schema• Mappings between the conceptual model and the storage-specific schema can

change without changing the application code• Developers can work with a consistent application object model that can be

mapped to various storage schemas• Multiple conceptual models can be mapped to a single storage schema• LINQ support provides compile-time syntax validation for queries against a

conceptual model

Benefits of Entity Framework Applications

Page 21: Module 1 Designing a Conceptual Database Model

Entity Framework Components

Conceptual Model

Logical Model

EntityClient Data Provider

ADO.NET Data Provider

Data Source

Entity SQL Query

Entity SQL Query

IEnumerable

<T>

Command Tree Entity

DataReader

Command Tree DBDataReader

Object Services

Language-Integrated

Query (LINQ) to Entities

Map

ping

Page 22: Module 1 Designing a Conceptual Database Model

• EDM types preserve the logical integrity of data and the constraints of applications

• Object models reflect the languages in which they are implemented

• Data structure in an EDM application is specified by using a conceptual schema

Selecting an Entity Data Model

< xml >

< xml >

• EDM entities and relationships are formally defined in XML syntax in a design schema

• EDM design schema is mapped to another schema containing metadata describing the storage model

• CLR data types used in the application code are built from the design schema

Designing EDM Types in Schemas

Implementing Object Services from Schemas

Page 23: Module 1 Designing a Conceptual Database Model

Using Entity Data Model Types

EDM Types

• Describe the primitive data types

• Have no internal properties

• Have an internal structure

• Help to implement a property that has internal properties of its own

EDM-Type Constraints

• Specifies whether the value of the property can be unassigned, or Null

• Specifies value for a property if no value is supplied when an instance of the entity is created

Nullable Constraint Default Attribute

Complex TypesSimple Types

Page 24: Module 1 Designing a Conceptual Database Model

Mapping a Conceptual Model to a Storage Schema

The Entity Framework provides an object-centric view of tabular data, expressed as entity types

• A separate data model uses store schema definition language (SSDL) to describe the logical model for persistent data, usually stored in a relational database

• The data types of properties declared in SSDL files are those of the storage model

The Storage Model

• A mapping specification uses mapping specification language (MSL) to connect the types declared in the conceptual model to the database metadata declared in the storage model

• This MSL fragment demonstrates a one-to-one mapping between the conceptual and storage models

The Mapping Specification

Page 25: Module 1 Designing a Conceptual Database Model

Entity Data Model Relationships

Characteristics of EDM relationships:

Multiplicity is the number of instances of a type that are related

Direction represents the association between the types

Degree of a relationship is the number of types among which the relationship existsü

ü

ü

Unary

Person

One to One

MANAGER

One to Many

Is_Married_To

EMPLOYEE

Binary

Is_Assigned

Contains

One to One

One to Many

Parking SpacePerson

ORDER Orderline

Supplier

Quantity

Ship

Tertiary

WarehouseProduct

Page 26: Module 1 Designing a Conceptual Database Model

Overview of Entity Mapping

Entity Mapping

• EDM uses MSL to connect the types declared in conceptual schema definition language (CSDL) to database metadata

• Namespace Name and EntityContainer Name declared in the CSDL schema identify entities and associations contained by the conceptual schema

• Entity sets that are contained by entity containers are mapped by using syntax similar to that used for entity containers

Logical Model

<? Xml ?><ssdl />

<? Xml ?><msl />

Mapping

<? Xml ?><csdl />

Conceptual Model

Page 27: Module 1 Designing a Conceptual Database Model

Using Entity Data Model Tools and Stored Procedures

Entity Designer

Entity Data Model Tools

EDM Stored Procedure Support

Entity Data Model Wizard

Update Model Wizard

• Security• Encapsulation• Predictability• Performance

Page 28: Module 1 Designing a Conceptual Database Model

What Is Entity SQL?

• Entity SQL is similar to the Transact-SQL language, and it is provided by the ADO.NET Entity Framework to support the EDM

• Entity SQL supports EDM constructs, enabling users to effectively query the data represented by an entity model

• The Entity Framework works with storage-specific data providers to translate generic Entity SQL into storage-specific queries

SELECT customers.Name FROM customers AS c

Example of Entity SQL

Page 29: Module 1 Designing a Conceptual Database Model

Using Entity SQL Components • Support inheritance and relationships

• Support collections

• Support expressions

• Treat subqueries uniformly

• Avoid implicit coercions for subqueries

• Avoid the implicit row wrapper

• Use left correlation and aliasing

• Reference column properties of tables

• Navigate through objects

• Support aliasing for group by keys

• Support collection-based aggregates

• Allow ORDER BY clauses

• Compare identifiers

• Avoid support for unqualified syntax

EDM Components

Page 30: Module 1 Designing a Conceptual Database Model

Lab 1: Designing a Conceptual Database Model

• Exercise 1: Formulating a Conceptual Database Design

• Exercise 2: Creating a Conceptual Database Design

Logon Information

Estimated time: 60 minutes

Virtual machine

User name

Password

NYC-SQL1

Administrator

Pa$$w0rd

Page 31: Module 1 Designing a Conceptual Database Model

Lab Scenario

You are a lead database designer at QuantamCorp. You are working on the Human Resources Vacation and Sick Leave Enhancement (HR VASE) project that is designed to enhance the current HR system of your organization. This system is based on the QuantamCorp2008 sample database in SQL Server 2008.

The main goals of the HR VASE project are as follows:

•Provide managers with current and historical information about employee vacation and sick leave.

•Grant view rights to individual employees to view their vacation and sick leave balances.

•Provide permission to selected employees in the HR department to view and update the vacation and sick leave details of employees.

•Grant the HR manager with the view and update rights to all the data.

You need to identify and gather database requirements, and then design a conceptual database model for the HR database based.

Page 32: Module 1 Designing a Conceptual Database Model

Module Review and Takeaways

• Review Questions

• Real-world Issues and Scenarios

• List of Tools