540 likes | 709 Views
University of Palestine. Software Engineering Department. Advanced Database Course (ESED5204). Eng. Hanan Alyazji. Database Design. Project Phases. Planning Why build the system? How should the team go about building it? Analysis
E N D
University of Palestine Software Engineering Department Advanced Database Course (ESED5204) Eng. Hanan Alyazji
Project Phases • Planning • Why build the system? How should the team go about building it? • Analysis • Who uses system, what will it do, where and when will the system be used? • Design • How will the system work? • Implementation • System delivery.
Planning • Identifying business value. • Analyze feasibility. • Develop work plan. • Staff the project. • Control and direct project.
Analysis • Analysis strategy. • Gathering business requirements. • Requirements definition use cases. • Process modeling. • Data modeling.
Design • Design selection. • Architecture design. • Interface design. • Data storage design. • Program design.
Implementation • Construction • Program building. • Program and system testing • Installation • Conversion strategy. • Training plan. • Support plan.
A Data Modeling Process Steps in the data modeling process • Plan project. • Determine requirements. • Specify entities. • Specify relationships. • Determine identifiers. • Specify attributes. • Specify domains. • Validate model.
1. Planning the Project: • Obtaining project authorization and budget. • Building the project team. • Planning the team’s activities. • Establishing tools, techniques, and standards for consistent results. • Defining the project’s target.
2.Determining System Requirements: • Sources for data modeling requirements. • User interviews and user activity observations. • Existing forms and reports. • New forms and reports. • Existing manual files. • Existing computer files/databases. • Formally defined interfaces (XML). • The result of the requirements determination will be a repository of notes, diagram, forms reports, and files that can be used to develop the data model.
3. Specifying Entities: • An entity is something that the users want to track; something the users want to keep data about. • Entities • Can be physical things or logical concepts. • Are identifiable; you can tell one from another. • Are things described by nouns, not characteristics described by adjectives.
4. Specifying Relationships: • Includes: • Relationship type. • Name of the relationships. • The name of the relation is followed (in parentheses) by the names of the attributes of that relation, e.g.: Student (Id, Name, Dept, DOB)
Entity Set -> Relation Relation: student (Id, name) Id name Student
Employee Flight Emp No Flight Id Flight No Date 5. Determining Identifiers: • Identifier is an attribute or group of attributes that uniquely identifies an entity instance.
First Name Mid Initials Name Last Name 6. Specifying Attributes and Domains: • Find attributes on forms, reports, existing files, and add them to entities. Emp No
7. Validating Model: • Data model is a model of humans’ models, not a model of reality. • A data model is wrong if it does not accurately reflect the ways the users think about their world. • Data models are validated through a series of reviews • Normally, a team review is followed by user reviews. • E-R model as well as prototypes of forms and reports may be used to communicate to users features of the data model.
Database Design Conceptual design Logical design Physical design
Example • A Company is organised into departments. • Each department has a number and an employee who manages the department. • We keep track of the start date when that employee started managing the department. • A department may have several locations. • A department controls a number of projects. • Each of which has a name, a number and a single location.
We store each employee’s name, Id number, address, salary, and birth date. • An employee is assigned to one department, but may work on several projects, which are not necessarily controlled, by the same department. • We keep track of the number of hours per week that an employee works on each project. • We also keep track of the direct supervisor of each employee. • We keep track of the dependants of each employee. • We keep each dependant’s name, birth date and relationship to the employee. • Phase 1 of database design process.. (i.e. Requirements Collection and Analysis )
Conceptual Design All the requirements collected at Phase 1 are analysed to create a Conceptual Schema. This process is called the Conceptual Design. We identify the entities, their attributes, relationships and constraints(business rules). The conceptual schema is used as a reference to ensure that all user’s data requirements are met and the requirements do not include any conflicts.
Conceptual Design Entities Department Employee Project Dependent
Dept No Dept Name Department Location Phone Employees Detailed Conceptual Design Dept No unique identifier of a dept. Identifier Dept Name nameof a department Unique Location location of a department Multi-valued Phone phone no. of a department Employees no. of employees in a dept. Derived
Proj No Project Proj Name Location Detailed Conceptual Design Project Name Number Location Department Control Leader Employee Proj No unique identifier of a project Identifier Proj Name name of a project Unique Location location of a project
Detailed Conceptual Design Employee Name National ID Address Salary Birth Date Works for Department Supervise Employee Emp No
Detailed Conceptual Design Employee Emp No unique identifier of an emp. Identifier Emp Name name of an employee First Name first name of an employee Mid Initials middle initials of an employee Last Name last name of an employee NID national id of an employee Unique Address address of an employee Salary salary of an employee Gender sex of an employee DOB birth date of an employee
First Name Emp No Mid Initials Emp Name Employee Last Name NID Address Salary Gender DOB Detailed Conceptual Design
Depd Name Gender Dependent DOB Relation Detailed Conceptual Design Dependent Name Birth Date Relationship Depd Name name of a dependent Part of Key Gender sexof a dependent DOB birth date of a dependent Relation relationship of a dependent to an employee
Conceptual Design Relationships A Department has Many Employees An Employee works for A Department
one to many relationship Department Personnel Sales Employee C A E B D A C B F E
Conceptual Design Relationships A Department has A Manager (Employee) An Employee manage A Department
one to one relationship Department Personnel Sales Manager (Employee) B D
Conceptual Design Relationships A Department controls Many Projects A Project controlled by A Department
Conceptual Design Relationships An Employee works on Many Projects A Project has Many Employees
many to many relationship Project Delivery Construction Employee D B C
Conceptual Design Relationships An Employee supervised by An Employee An Employee supervise Many Employees
Conceptual Design Relationships An Employee has Many Dependants A Dependant belongs to An Employee
Conceptual Design Entities / Relationships?? A Company has Many Departments A Department has Many Locations
Conceptual Design Notations Entity Relationship Attribute
DEPARTMENT MANAGES EMPLOYEE WORKS_ON PROJECT
One to One director Company Employee Existence Conditions D ABC Ltd. B C
One to Many director Company Employee Existence Conditions D ABC Ltd. B C
Many to Many director Company Employee Existence Conditions XYZ Ltd. D B C ABC Ltd.
supervise works Department Employee manage has control works on Dependent Project
Exercise (Conceptual design) Create a conceptual E.R model of the database for the following lists. (List up the necessary DATA ITEMS, set up ENTITIES and their ATTRIBUTES, and identify the relationship among the entities ) List 1 Track No: 1 Track name: Managing information using Database Participant name Participant code Age Position Country Address List 1 is the list of participants’ information by track List 2 Country code Country name Participant code Participant name Track name List 2 is the list of participants’ information by countries
Answer Just one One or many Zero one or many Just one
Exercise: Primary and Foreign Key Please identify primary and foreign key. Participant code Participant name Age Position Address Country code Participant code Track code Track name Country code Country name Primary key Foreign key
Answer Participant code Participant name Age Position Address Country code Participant code Track code Track name Country code Country name
Logical Design • For each table, need to define: • Name of the table; • List of simple columns in brackets; • PK and, where appropriate, and FKs. • Referential integrity constraints for any FKs identified. • For each column, need to define: • Its domain, consisting of a data type, length, and any constraints on the domain; • An optional default value for the column; • Whether the column can hold nulls.
Integrity constraints • These help maintain the accuracy and integrity of the data in the database. • Domain Constraints - a domain is the set of allowable values for an attribute. • Domain definition usually consists of 4 components: domain name, meaning, data type, size (or length), allowable values/allowable range (if applicable). • Entity Integrity ensures that every relation has a primary key, and that all the data values for that primary key are valid. No primary key attribute may be null.