Database Design

Victor Matos

Phases of Database Design
Data Requirements Specification of requirements and results Conceptual Design 

Conceptual design begins with

Conceptual Schema Logical Design

Logical Schema Physical Design Physical Schema

the collection of requirements and results needed from the database (ER Diag.)  Logical schema is a description of the structure of the database (Relational, Network, etc.)  Physical schema is a description of the implementation (programs, tables, dictionaries, catalogs

Models A data model is a collection of objects that can be used to represent a set of data and operations to manipulate the data  Conceptual models are tools for representing reality at a very high-level of abstraction  Logical models are data descriptions that can be processed by computers 3 .

Conceptual model: Entity-Relationship Diagrams  Entities represent classes of real-world objects. Courses are entities of a University database  Relationships represent interactions between two or more entities N 1 ives_I Pers Is_B r _I N 1 it 4 . Person. Students. Projects.

Example:  Every employee works in at least one project  Every project has employees working on it. EMPLOYEE SSN Name Salary N N WORKS ON PROJECT Name Code 5 .

Higher-Order Relationships A relationship may involve more than two entities Course Meets Cl ssroom Day 6 .

Recursive relationships Relationships could be mapped from one entity to itself Manager_Of 1 Employee N Manages Subordinate_To 7 .

The stored data will be kept as values of the attributes Li es In N 1 PERSON Ssn Name Profession Is N Mo ing Date irth Date CITY Name Country Ele ation Population 1 orn In 8 .Attributes Attributes represent elementary properties of the entities or relationships.

Generalizations ‡ An entity could be seen from many different viewpoints ‡ Each viewpoint defines a set of roles in a generalization ‡ Example below uses SEX to classify the object ³Person´ PERSON Ssn Name Address MAN Draft Status FEMALE Maiden Name 9 .

Generalizations A classification could be disjoint or overlapping  An entity could have more than one classification PERSON Ssn Name Address SEX MAN Draft_ tatus FEMALE Mai en_ ame Full_Tim Annual_Salary Department   OB Part_Tim Hour_ ate Weekly_Hours 10 .

Example: Department Store A 1/2 department store operates in several cities  In a city there is one headquarter coordinating the local operations  A city may have several stores  Stores hold any amount of items  Customers place their orders for any number of items to a given store GOAL: Optimize shopping in each city 11 .

Example: Department Store STORES Store ID Address Manager ID N 1 LOCATED IN 2/2 CITIES City Na e State HeadQtr Address N N HOLD Qty Held IN-CITIES Qty_in_cities CUSTOMER Customer Name Address Phone Number N N 1 ITEMS Item ID Description Size Color N ITEMS ORDERED Qty Ordered N ORDERS Order Number Order Date N PLACE 12 .

need an End/Start date 13 .Example: University Database  Professors work for only one department  Departments have many professors  Each course is taught by only one professor  Students make a plan or program of study  A course could meet in several rooms/times  Graduate students must have an advisor  Cities are categorized as resident/BirthPlace  Visiting prof.

University Database CITY Name State N RESIDENT N N 1 N BIRTH_PLACE PERSON LastName Age DEPARTMENT Name Phone 1 Belongs_To STUDENT PROFESSOR TenureStatus Title N N 1 VISITING_ PROFESSOR Start_Appointment End_Appointment ENROLLED Semester Grade PLANNED Semester GRADUATE_STUDENT N ADVISED_BY N N COURSE Title Description Credits 1 TIME Day Hour N MEETS N ROOM RoomNumber Building N TAUGHT_BY Semester 1 University database 14 .

Soccer Database A team has players. fans  Teams play according to a schedule  Teams need to practice in a Stadium  Attendance and scores must be recorded 15 . one coach.

Soccer Database PERSON Ssn Name Address FAN Name Address Favori e Bar N SUPPORTS N PLAYS _FOR 1 MANAG S 1 N TEAM Name Location Phone N PRACTIC S PLAY_ AGAINST N N GAME N N N ¥ ATT N DS ¥ Number Attendance Final Score Date TAK S PLAC AT STADIUM 1 Name Address Capacity ¥ N ¥ ¥ Uni orm_Si e Shoe_Si e Personal Record Years xperience 1 ¤ ¤ PLAYER OA H £ £ ¢ ¡ ¥ 16 .

Research Project Database  Some employees are researchers  Every project has a leader investigator  Every project must be funded by an agency  A project may include several topics  A topic could appear in several projects  Researchers must produce report(s)  Each employee must have a supervisor 17 .

Research Projects Database RESEARCH REPORT Number Title 1 N ADDRESSES N N PROD CES ¦ SUPERVISE S N N RESEARCH PROJECT Name Code PRINCIPAL 1 INVESTI ATOR § RESEARCH TOPIC Code Name N ON N N 1 EMPLOYEE SSN Name Title N FUNDED_BY Amount Date rant# § N WORKS _ON N N AGENCY Name Address Contact Person 18 .

Contract-Supplies System A 1/3 company negotiates contracts with suppliers to provide certain amount of items at a fixed price  Orders are placed against any of the already negotiated contracts  A contract could provide items to any number of orders 19 .

Contract-Supplies System  An 2/3 order may include any number of items negotiated in the contract  Orders should not exceed the maximum amount of items quoted in the contract  All items in an order must be provided as part of a single contract and a single project 20 .

Contract-Supplies System SUPP IERS Supplier Nu ber Na e Address 1 3/3 N 1 N SUPPLY Contract Price Contract A ount N © ©       ITE S Ite Nu ber Description N AD rder Q Y N ORDERS rder Nu ber Date Required Date Co pleted    CON RACTS Contract Nu ber ext 1 SUPPLI D AS N N D D BY N © N IA Date of Contract  © ©     © © ©  © ¨ PROJECTS Project Nu ber Project Data     21 .

Manufacturing: Requisitions  Projects 1/3 are broken into tasks  Tasks are assigned to departments  A task is created for one project and assigned to one department  Requisitions are made for projects  Each requisition could ask for any number of items 22 .

Manufacturing: Requisitions  Each 2/3 requisition is for one project and is made to one supplier  Items could be: equipment or materials and are coded in a similar way  Suppliers send periodic price notices to advise the company of any changes in their prices 23 .

Manufacturing: Requisitions PROJECTS Project Number Project Data 1 REQUESTS 1 MADE OF N TASKS Task Number Task Data 1 FOR N SUPPLIERS Supplier Number Supplier Data 1 SENDS 3/3 N REQUISITION Item Number Qty Requested N 1 FROM N CONTAINS N ITEMS Item Number Item Data 1 N N PRICE ADVICE Price Effective Date CHANGES EQUIPMENT ITEM Code Description MATERIAL ITEM Code Description Weight Container 24 .

FIT. CUT 25 .Job-Shop Accounting System  The 1/4 system is used by a company that manufactures special-purpose assemblies for customers  To manufacture assemblies the company creates a sequence of processes (steps)  Each process is supervised by a department  Assume there are three type of processes: PAINT.

it may pass through the same process more than once  A unique Job# is given to any new assembly. in any order.  Costs and started-terminated dates must be recorded 26 .Job-Shop Accounting System  During 2/4 manufacturing an assembly could pass through any sequence of processes.

cost transactions can be recorded against it.Job-Shop Accounting System  An 3/4 accounting system is used to keep track expenditure for each: DEPT.  PROCESS. 27 .  ASSEMBLY   As a job proceeds.

Job-Shop Accounting System CUSTOMER S Customer ID Address A1 ORDERS ASSEMBLY ACCOUNTS Account 1 Details DEPT ACCOUNTS Account 2 Details ACCOUNTS Account ID Date Established 4/4 T1 TRANSACTIONS T2 PROCESS ACCOUNTS Account 3 Details ASSEMBLIE S Assembly ID Date Ordered Details ACTIVITY MADE AS A2 T3 DEPARTMENT S Dept Number Dept Data JOBS Job Number Starting Date Ending Date Total Cost CUT JOBS Cut Job ID Machine type used Material used Laor time PAINT JOBS Paint Job ID Color Volume Labor time USED IN USES PROCESSES Process ID Process Data A3 FIT JOBS Fit Job ID Labor time PAINT PROC Paint Proc ID Paint Method FIT PROC Fit Proc ID Fit Type CUT PROC Cut Proc ID Cuttong Type Machine Type 28 .

Sign up to vote on this title
UsefulNot useful