Database Design FDD
What is a Database? <ul><li>A collection of data that is organised in a predictable structured way </li></ul><ul><li>Any o...
What is Data? <ul><li>The heart of the DBMS. </li></ul><ul><li>Two kinds </li></ul><ul><ul><li>Collection of information t...
Relational Data Model <ul><li>A  relational database is perceived as a collection of tables. </li></ul><ul><li>Each table ...
Features of the relational data model <ul><li>Logical and Physical separated </li></ul><ul><li>Simple to understand. Easy ...
<ul><li>Relation </li></ul><ul><li>A 2-dimensional table of values with these properties: </li></ul><ul><li>No duplicate r...
<ul><li>Tuple </li></ul><ul><li>Commonly referred to as a row in a relation.  </li></ul><ul><li>Eg: </li></ul>Terminology ...
<ul><li>A pool of atomic values from which cells a given column take their values. Each attribute has a domain. </li></ul>...
<ul><li>A Relational Schema is a named set of attributes. This refers to the structure only of a relation. It is derived f...
<ul><li>An  Integrity Constraint  is a condition that prescribes what </li></ul><ul><li>values are allowable in a relation...
<ul><li>A condition that no value of an attribute or set of attributes be repeated in a relation. </li></ul><ul><li>e.g.  ...
Terminology:Key Constraint An attribute (or set of attributes) to which a key constraint applies is called a key ( or cand...
Terminology:Key Constraint A key cannot have a  NULL (  )  value. For example,  If we change the table so that the Employe...
<ul><li>A  primary key  is a special preassigned key that can  </li></ul><ul><li>always be used to uniquely identify tuple...
A D atabase  is more than multiple tables you must be able to “relate” them The link is through the Agent-Code Cus-code Cu...
Terminology: Relational Database A Relational  Database  is just a set of Relations. For example Which Attribute do you th...
Terminology:Relational   Database Schema A Relational  Database   Schema  a set of  Relation Schemas , together with  a se...
Terminology :Referential Integrity Constraint This constraint says that – All the values in one column should also appear ...
Referential Integrity Constraint Why does the following relational database violate the referential integrity constraints?...
Why Use Relational Databases <ul><li>Their major advantage is they minimise the need to store the same data in a number of...
Example of Data Redundancy (1)
Example of Data Redundancy (2) <ul><li>The names and addresses of all students are being maintained in three places </li><...
Example of Data Redundancy (3)
Example of Data Redundancy (4) <ul><li>Data redundancy results in: </li></ul><ul><ul><li>wastage of storage space by recor...
Other Advantages of Relational Databases <ul><li>Flexibility </li></ul><ul><ul><li>relationships (links) are not implicitl...
Summary of Some Common Relational Terms <ul><li>Entity  - an object (person, place or thing) that we  wish to store data a...
Network Diagrams
Terminology: Network Diagram EMPLOYEE( Employee , Job, Manager)  JOB( Job , Salary) A relational database schema with refe...
Personnel Database: Consider the following Tables  PROJECT NAME P_NUMBER   MANAGER ACTUAL_COST  EXPECTED_COST  New billing...
<ul><li>ASSIGNMENT  ( E_NUMBER,  P_NUMBER ) </li></ul><ul><li>PRIOR_JOB  ( E_NUMBER, PRIOR_TITLE ) </li></ul><ul><li>EXPER...
TITLE  PROJECT  PRIOR_JOB EMPLOYEE SKILL  EXPERTISE Personnel   Database   Network   Diagram   ASSIGNMENT Once you have pr...
Personnel   Database   Network   Diagram   TITLE  PROJECT  PRIOR_JOB EMPLOYEE SKILL  EXPERTISE skill e_number p_number e_n...
Summary: Questions <ul><li>What is a Relational Database? </li></ul><ul><li>What is a relation? </li></ul><ul><li>What are...
Summary: Answers <ul><li>A relational database is based on the relational data model. It is one or more Relations(Tables) ...
Activities <ul><li>Consider the following relational database schemas. </li></ul><ul><li>Suppliers(suppId, name, street, c...
Answer Supplies Supplier Part Uses Product
<ul><li>Show the foreign keys on the network diagrams </li></ul><ul><li>Orders </li></ul><ul><li>Customer </li></ul><ul><l...
<ul><li>OrLine </li></ul>ordNum Part date quotePrice
Answer Orders OrLine Part Customer SalesRep SlsNumber CustNumb orLine Part
Activities <ul><li>What problems many arise from this table? </li></ul><ul><ul><li>What data redundancies are there? </li>...
Activities <ul><li>What is wrong with this table? </li></ul>
Functional Dependence FDD
Functional Dependency Diagrams <ul><li>A   FUNCTIONAL DEPENDENCY DIAGRAM is a way of </li></ul><ul><li>representing the st...
Data Analysis and Database Design Using Functional Dependency Diagrams <ul><li>The steps of Data Analysis in FDD are </li>...
Starting points for drawing functional dependency diagrams <ul><li>We must Understand the data </li></ul><ul><li>We Examin...
Enterprise Rules <ul><li>What are Enterprise / Business Rules? </li></ul><ul><li>An enterprise rule (in the context of dat...
Drawing FDDs - Data Elements <ul><li>We often refer to Data Elements during the FDD process </li></ul><ul><li>A data eleme...
Functional Dependency Diagrams Now we have the Database Design 2NF  Relation 3NF  Relation Universal  Relation 1NF Tables ...
Data Element Examples <ul><li>Here are some examples </li></ul><ul><li>PersonName  has values  Jeff, Jill, Gio, Enid </li>...
Drawing FDDs Data Elements <ul><li>Start drawing the Functional Dependency Diagram by </li></ul><ul><li>representing the D...
<ul><li>A functional Dependency is a relationship between Attributes. </li></ul><ul><li>It is shown as an arrow e.g     A ...
Data Element Examples Surname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . On a form gives rise to th...
Functional Dependency Examples Students and their family names “ Each student (identified by student number) has only one ...
FDDs Answer Students  determine  FamilyName (or FamilyName  depends  on Students) Each student has exactly one family name...
FDDs Examples Employees and the departments they work for. In this example the tables are representing some interesting da...
FDD Answers Employees and the departments they work for. Data elements of interest are  Employee#  and  DeptName” Employee...
FDDs Examples The quantity of parts held in a warehouse and their suppliers Part#  determines  SupplierName & Part#  deter...
FDDs Examples Students and their subjects enrolled. “ Each student is given a unique student number” “ A subject is unique...
FDDs Examples Results obtained by each student for each subject. “ Each student is given a unique student number” “ A subj...
FDDs Examples Results obtained by each student for each subject. Try and construct an FDD for this table considering the g...
FDDs Examples Results obtained by each student for each subject. Student # StudentName We can see that there is only one a...
FDDs Answer Results obtained by each student for each subject. Student SubjectName Grade StudentName This is called the Co...
FDDs Examples Customer Orders Validating functional dependencies Using simple data and populating the table, check there i...
FDDs Examples “ Orders is uniquely identified by its names” “ Customers are uniquely identified by their names” “ A custom...
FDDs Examples Employees and their tax files numbers “ Each employee has a unique employee number” “ Each employee has a un...
<ul><li>Obtain Tutorial 1 from your tutor. </li></ul>
Functional Dependency Diagrams Database Design Let’s look at the process of converting the FDD into a schema. We have a 12...
Functional Dependency   Diagram Preparation  1. Represent each data element as a box. 2. Represent each functional depende...
Deriving 3NF Schema: Synthesis Algorithm 6. Pick any (unmarked) arrow in the diagram. 7. Follow it back to its source, and...
Synthesis Algorithm :  Deriving 3NF Schema 9.   Mark all the arrows just processed. 10.   If there are any unmarked arrows...
A  Fully  Worked Example <ul><li>We will now work from a given set of forms to produce an FDD then use the 12 steps to pro...
EMPLOYEE  ______________________________________________________________________________________________________________ N...
EMPLOYEE  __________________________________________________________________________________________________________ NAME ...
<ul><li>TIME_SPENT </li></ul>EXPECTED_COST  Personnel Database FD   Diagram  LOCATION ACTUAL_COST MANAGER _NUM PROJECT_NAM...
EXPECTED_COST  Personnel Database FD Diagram -Synthesis  ACTUAL_COST MANAGER _NUM PROJECT_NAME P_NUMBER Let us just consid...
LOCATION DEPARTMENT_NAME Personnel Database FD Diagram - Synthesis  So the table   DEPT ( DEPARTMENT_NAME , LOCATION)   is...
Personnel Database FD Diagram - Synthesis  CURRENT_TITLE E_NUMBER EMPLOYEE_NAME DEPARTMENT_NAME EMPLOYEE  (EMPLOYEE_NAME, ...
<ul><li>TIME_SPENT </li></ul>P_NUMBER E_NUMBER Personnel Database FD Diagram - Synthesis  Try to create the Assignment tab...
<ul><li>TIME_SPENT </li></ul>P_NUMBER E_NUMBER Personnel Database FD Diagram - Synthesis  ASSIGNMENT  ( E_NUMBER, P_NUMBER...
P_NUMBER E_NUMBER PRIOR_TITLE SKILL UK  ( E_NUMBER, P_NUMBER, PRIOR_TITLE,  SKILL) Personnel Database FD Diagram - Univers...
Foreign Keys <ul><li>In the Synthesis Algorithm, a foreign key will arise from any attribute that is: </li></ul><ul><ul><l...
ISA = Is A <ul><li>Every MANAGER value  is a  E_NUMBER value. </li></ul><ul><li>Gives rise to a new Foreign Key </li></ul>...
<ul><li>ASSIGNMENT  ( E_NUMBER, P_NUMBER,  TIME_SPENT) </li></ul>EMPLOYEE  (NAME,  E_NUMBER,  DEPARTMENT, CURRENT TITLE ) ...
<ul><li>ASSIGNMENT   </li></ul>EMPLOYEE PROJECT  UK Personnel Database Network Diagram Generated by Synthesis  E_NUMBER + ...
A Fully Worked Example We now have to take care of the multi-valued areas such as skills and prior titles. Our FDD synthes...
E_NUMBER PRIOR_TITLE SKILL MVDs PRIOR_JOB  ( E_NUMBER, PRIOR_TITLE ) EXPERTISE  ( E_NUMBER,  SKILL) Personnel Database Mul...
<ul><li>TIME_SPENT </li></ul>EXPECTED_COST  Personnel Database FD Diagram with MVDs and Inclusion  LOCATION ACTUAL_COST MA...
<ul><li>ASSIGNMENT  ( E_NUMBER, P_NUMBER,  TIME_SPENT) </li></ul><ul><li>PRIOR_JOB  ( E_NUMBER, PRIOR_TITLE ) </li></ul><u...
<ul><li>ASSIGNMENT   </li></ul>EMPLOYEE PROJECT  PRIOR_JOB EXPERTISE Final  Personnel Database Network Diagram E_NUMBER P_...
EXPECTED_COST  Personnel Database FD Diagram - Synthesis  ACTUAL_COST MANAGER PROJECT_NAME P_NUMBER PROJECT  (PROJECT_NAME...
Role Splitting In Functional Dependency Diagrams <ul><li>In a Functional Dependency Diagram any group of attributes can be...
Role Splitting In Functional Dependency Diagrams <ul><li>We can choose to split the  E_NUMBER  attribute into  E_NUMBER  a...
Role Splitting In FDD s <ul><li>Alternatively, we can choose to split the  DEPARTMENT_NAME  attribute into  EMPLOYING_DEPT...
Role Splitting Example Consider this example. We have the Employee with many Skills, Prior Titles, as before but we also h...
LOCATION CURRENT_TITLE E_NUMBER EMPLOYEE_NAME PRIOR_TITLE SKILL DEPARTMENT_NAME SERIAL# DESCRIPTION UK <ul><li>MVDs not ne...
<ul><li>Obtain Tutorial 2 from your tutor. </li></ul>
Upcoming SlideShare
Loading in...5
×

Database Design Fdd 2009

1,201

Published on

Published in: Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,201
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
44
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design 2006 version 1.2
  • Database Design Fdd 2009

    1. 1. Database Design FDD
    2. 2. What is a Database? <ul><li>A collection of data that is organised in a predictable structured way </li></ul><ul><li>Any organised collection of data in one place can be considered a database </li></ul><ul><li>Examples </li></ul><ul><ul><li>filing cabinet </li></ul></ul><ul><ul><li>library </li></ul></ul><ul><ul><li>floppy disk </li></ul></ul>
    3. 3. What is Data? <ul><li>The heart of the DBMS. </li></ul><ul><li>Two kinds </li></ul><ul><ul><li>Collection of information that is stored in the database. </li></ul></ul><ul><ul><li>A Metadata, information about the database. Also known as a data dictionary. </li></ul></ul>
    4. 4. Relational Data Model <ul><li>A relational database is perceived as a collection of tables. </li></ul><ul><li>Each table consists of a series of row s & column s . </li></ul><ul><li>Tables (or relations) are related to each other by sharing a common characteristic. (EG a customer or product table) </li></ul><ul><li>A table yields complete physical data independence. </li></ul>
    5. 5. Features of the relational data model <ul><li>Logical and Physical separated </li></ul><ul><li>Simple to understand. Easy to use. </li></ul><ul><li>Powerful nonprocedural (what, not how) language to access data. </li></ul><ul><li>Uniform access to all data. </li></ul><ul><li>Rigorous database design principles. </li></ul><ul><li>Access paths by matching data values, not by following fixed links . </li></ul>
    6. 6. <ul><li>Relation </li></ul><ul><li>A 2-dimensional table of values with these properties: </li></ul><ul><li>No duplicate rows </li></ul><ul><li>Rows can be in any order </li></ul><ul><li>Columns are uniquely named by Attributes </li></ul><ul><li>Each cell contains only one value </li></ul>Terminology The special value is NULL which implies that there is no corresponding value for that cell. This may mean the value does not apply or that it is unavailable. Entire rows of NULLs are not allowed. Employee Job Manager Jack Secretary Jill Jill Executive Bozo Bozo Director Lulu Clerk Jill
    7. 7. <ul><li>Tuple </li></ul><ul><li>Commonly referred to as a row in a relation. </li></ul><ul><li>Eg: </li></ul>Terminology <ul><li>Attribute </li></ul><ul><li>A name given to a column in a relation. Each column must have a </li></ul><ul><li>unique attribute. This are often referred to as the fields. </li></ul>Employee Job Manager Jack Clerk Jill
    8. 8. <ul><li>A pool of atomic values from which cells a given column take their values. Each attribute has a domain. </li></ul><ul><li>Attributes may share domains </li></ul>Terminology: Domain Typist Manager Clerk........ Tom Mary Bozo Kali ........ Here again we use the same domain as above in employee. An attribute value (a value in a column labelled by the attribute) must be from the corresponding domain or may be NULL ( ). Attribute Domain Employee Person Name Job Job Name Manager Person Name
    9. 9. <ul><li>A Relational Schema is a named set of attributes. This refers to the structure only of a relation. It is derived from the traditional set notation displayed below </li></ul><ul><li>EMPLOYEE = { Employee, Job, Manager } </li></ul><ul><li>This is usually written in the modified version for database purposes: </li></ul><ul><li>EMPLOYEE( Employee, Job, Manager ) referring to the Table </li></ul>Terminology:Relation Schema EMPLOYEE Employee Job Manager
    10. 10. <ul><li>An Integrity Constraint is a condition that prescribes what </li></ul><ul><li>values are allowable in a relation. This permits the restriction of the type of value that can be placed in a particular cell. Eg. only numbers for telephone numbers </li></ul><ul><li>The Domain Constraint is a condition on the allowable values for an attribute. </li></ul><ul><li>e.g. Salary < $60,000 </li></ul>Terminology:Integrity Constraint and Domain Constraint EMPLOYEE This restricts the salary to be under a set value . Employee Job Manager Salary Jack Secretary Jill 25,000 Jill Executive Bozo 40,000 Bozo Director 50,000 Lulu Clerk Jill 30,000
    11. 11. <ul><li>A condition that no value of an attribute or set of attributes be repeated in a relation. </li></ul><ul><li>e.g. Employee(the attribute) has only unique values in EMPLOYEE (the relation). </li></ul><ul><li>The following relation violates this constraint: </li></ul>Terminology:Key Constraint EMPLOYEE Jack appears twice. This means that This violates the Key Constraint Employee Job Manager Salary Jack Secretary Bozo 25,000 Jack Secretary Jill 25,000 Jill Executive Bozo 40,000 Bozo Director 50,000 Lulu Clerk Jill 30,000
    12. 12. Terminology:Key Constraint An attribute (or set of attributes) to which a key constraint applies is called a key ( or candidate key). Every relation schema must have a key. If a key constraint applies to a set of attributes, it is called a composite or Concatenated Key. Otherwise it is a simple key. Key Simple Key Composite Key: EMPLOYEE Another possible key. The combination of Job and manager is also unique Employee Job Manager Salary Jack Secretary Bozo 25,000 Kim Secretary Jill 25,000 Jill Executive Bozo 40,000 Bozo Director Bozo 50,000 Lulu Clerk Jill 30,000
    13. 13. Terminology:Key Constraint A key cannot have a NULL ( ) value. For example, If we change the table so that the Employee Bozo does not have a manager then Job+Manager cannot be a key. Employee Job Manager Salary Jack Secretary Bozo 25,000 Kim Secretary Jill 25,000 Jill Executive Bozo 40,000 Bozo Director 50,000 Lulu Clerk Jill 30,000
    14. 14. <ul><li>A primary key is a special preassigned key that can </li></ul><ul><li>always be used to uniquely identify tuples. We have to choose a Primary Key for every Relation. We must consider all of the Candidate Keys and choose between them. </li></ul><ul><li>Employee is a primary key for EMPLOYEE is usually </li></ul><ul><li>written as: </li></ul><ul><li>EMPLOYEE( Employee , Job, Manager, Salary ) </li></ul>Terminology:Key Constraint Here we have chosen the Simple Key Employee Over the concatenated option of both Job and Manager Employee Job Manager Salary Jack Secretary Bozo 25,000 Kim Secretary Jill 25,000 Jill Executive Bozo 40,000 Bozo Director Bozo 50,000 Lulu Clerk Jill 30,000
    15. 15. A D atabase is more than multiple tables you must be able to “relate” them The link is through the Agent-Code Cus-code Cus-Name Area-Code Phone Agent-Code 10010 Ramus 615 844-2573 502 10011 Dunne 713 894-1238 501 10012 Smith 615 894-2205 502 10013 Olowaski 615 894-2180 502 10014 Orlando 615 222-1672 501 10015 O’Brian 713 442-3381 503 10016 Brown 615 297-1226 502 10017 Williams 615 290-2556 503 10018 Farris 713 382-7185 501 10019 Smith 615 297-3809 503 Agent-Code Agent-Name Agent-AreaCode Agent-Phone 501 Alby 713 226-1249 502 Hahn 615 882-1244 503 Okon 615 123-5589
    16. 16. Terminology: Relational Database A Relational Database is just a set of Relations. For example Which Attribute do you think relates these two tables together? JOB EMPLOYEE Job Salary Secretary 25,000 Secretary 25,000 Executive 40,000 Director 50,000 Clerk 30,000 Employee Job Manager Salary Jack Secretary Bozo 25,000 Kim Secretary Jill 25,000 Jill Executive Bozo 40,000 Bozo Director 50,000 Lulu Clerk Jill 30,000
    17. 17. Terminology:Relational Database Schema A Relational Database Schema a set of Relation Schemas , together with a set of Integrity Constraints . For example the Relations that you have been looking at with the headings EMPLOYEE JOB are usually written as EMPLOYEE( Employee , Job, Manager) JOB( Job , Salary) Notice how the Primary Keys are underlined Employee Job Manager Salary Job Salary
    18. 18. Terminology :Referential Integrity Constraint This constraint says that – All the values in one column should also appear in another column. Look at the table below. Every entry in the Job column of the Employee table must appear in the Job column of the Job table EMPLOYEE JOB FK PK FK PK Employee Job Manager Jack Secretary Bozo Kim Secretary Jill Jill Executive Bozo Bozo Director Lulu Clerk Jill Job Salary Secretary 25,000 Secretary 25,000 Executive 40,000 Director 50,000 Clerk 30,000
    19. 19. Referential Integrity Constraint Why does the following relational database violate the referential integrity constraints? In other words, Why can’t Employee(Job) be a Foreign Key to Job(Job), or Employee(Manager) be a Foreign Key to Employee(Employee)? Click here for the answers EMPLOYEE JOB FK FK PK PK Job Salary Director 50,000 Clerk 30,000 Employee Job Manager Jack Secretary Bozo Kim Secretary Jill Bozo Director Lulu Clerk Jill
    20. 20. Why Use Relational Databases <ul><li>Their major advantage is they minimise the need to store the same data in a number of places </li></ul><ul><li>This is referred to as data redundancy </li></ul>
    21. 21. Example of Data Redundancy (1)
    22. 22. Example of Data Redundancy (2) <ul><li>The names and addresses of all students are being maintained in three places </li></ul><ul><li>If Owen Money moves house, his address needs to be updated in three separate places </li></ul><ul><li>Consider what might happen if he forgot to let library administration know </li></ul>
    23. 23. Example of Data Redundancy (3)
    24. 24. Example of Data Redundancy (4) <ul><li>Data redundancy results in: </li></ul><ul><ul><li>wastage of storage space by recording duplicate information </li></ul></ul><ul><ul><li>difficulty in updating information </li></ul></ul><ul><ul><li>inaccurate, out-of-date data being maintained </li></ul></ul>
    25. 25. Other Advantages of Relational Databases <ul><li>Flexibility </li></ul><ul><ul><li>relationships (links) are not implicitly defined by the data </li></ul></ul><ul><li>Data structures are easily modified </li></ul><ul><li>Data can be added, deleted, modified or queried easily </li></ul>
    26. 26. Summary of Some Common Relational Terms <ul><li>Entity - an object (person, place or thing) that we wish to store data about </li></ul><ul><li>Relationship - an association between two entities </li></ul><ul><li>Relation - a table of data </li></ul><ul><li>Tuple - a row of data in a table </li></ul><ul><li>Attribute - a column of data in a table </li></ul><ul><li>Primary Key - an attribute (or group of attributes) that uniquely identify individual records in a table </li></ul><ul><li>Foreign Key - an attribute appearing within a table that is a primary key in another table </li></ul>
    27. 27. Network Diagrams
    28. 28. Terminology: Network Diagram EMPLOYEE( Employee , Job, Manager) JOB( Job , Salary) A relational database schema with referential integrity constraints can also be represented by a network diagram. A Referential Integrity Constraint is notated as an arrow labeled by the foreign key. You must always write the label of the Foreign Key on the arrow. Sometimes the same attribute has different titles in different tables. EMPLOYEE JOB Job Manager Network Diagram Referential Integrity constraints can easily be represented by arrows FK PK. The arrow points from the Foreign Key to the matching Primary Key Notice here, the label is Manager and not Employee.
    29. 29. Personnel Database: Consider the following Tables PROJECT NAME P_NUMBER MANAGER ACTUAL_COST EXPECTED_COST New billing system 23760 Yates 1000 10000 Common stock issue 28765 Baker 3000 4000 Resolve bad debts 26713 Kanter 2000 1500 New office lease 26511 Yates 5000 5000 Revise documentation 34054 Kanter 100 3000 Entertain new client 87108 Yates 5000 2000 New TV commercial 85005 Baker 10000 8000 ASSIGNMENT SKILL E_NUMBER P_NUMBER AREA 1001 26713 Stock Market 1002 26713 Taxation 1003 23760 Investments 1003 26511 Management 1004 26511 1004 28765 1005 23760 EMPLOYEE TITLE NAME E_NUMBER DEPARTMENT E_NUMBER CURRENT _ TITLE Kanter 1111 Finance 1001 Senior consultant Yates 1112 Accounting 1002 Senior consultant Adams 1001 Finance 1003 Senior consultant Baker 1002 Finance 1004 Junior consultant Clarke 1003 Accounting 1005 Junior consultant Dexter 1004 Finance Early 1005 Accounting PRIOR_JOB EXPERTISE E_NUMBER PRIOR_TITLE E_NUMBER SKILL 1001 Junior consultant 1001 Stock market 1001 Research analyst 1001 Investments 1002 Junior consultant 1002 Stock market 1002 Research analyst 1003 Stock market 1003 Junior consultant 1003 Investments 1004 Summer intern 1004 Taxation 1005 Management
    30. 30. <ul><li>ASSIGNMENT ( E_NUMBER, P_NUMBER ) </li></ul><ul><li>PRIOR_JOB ( E_NUMBER, PRIOR_TITLE ) </li></ul><ul><li>EXPERTISE ( E_NUMBER, SKILL ) </li></ul><ul><li>TITLE ( E_NUMBER, CURRENT TITLE ) </li></ul>EMPLOYEE (NAME, E_NUMBER, DEPARTMENT) SKILL ( AREA ) PROJECT (NAME, P_NUMBER , MANAGER, ACTUAL_COST, EXPECTED_COST ) Personnel Database Schema Not FK , we will look at this later What are the connecting Foreign Keys to Primary Keys?
    31. 31. TITLE PROJECT PRIOR_JOB EMPLOYEE SKILL EXPERTISE Personnel Database Network Diagram ASSIGNMENT Once you have produced your Schema and identified the Primary and Foreign Keys you can create the Network Diagram.The Network Diagram shows each of the tables with their links. Each of the Tables (Relations) are represented in a rectangle as shown. They are then connected by arrows that show the FKs pointing to the PKs, The arrow head points towards the PK, while the FK name written is the same as the attribute of the table that has the FK in it.
    32. 32. Personnel Database Network Diagram TITLE PROJECT PRIOR_JOB EMPLOYEE SKILL EXPERTISE skill e_number p_number e_number e_number e_number manager ASSIGNMENT
    33. 33. Summary: Questions <ul><li>What is a Relational Database? </li></ul><ul><li>What is a relation? </li></ul><ul><li>What are Constraints? </li></ul><ul><li>What is a Schema? </li></ul><ul><li>What is a Network Diagram and why is it used? </li></ul>
    34. 34. Summary: Answers <ul><li>A relational database is based on the relational data model. It is one or more Relations(Tables) that are Related to each other </li></ul><ul><li>A relation is a table composed of rows (tuples) and columns, satisfying 5 properties </li></ul><ul><ul><li>No duplicate rows </li></ul></ul><ul><ul><li>Rows can be in any order </li></ul></ul><ul><ul><li>Columns are uniquely named by Attributes </li></ul></ul><ul><ul><li>Each cell contains only one value </li></ul></ul><ul><ul><li>No null rows. </li></ul></ul><ul><li>Constraints are central to the correct modeling of business information. Here we have seen them limit the set up of your tables: Referential Constraint </li></ul><ul><li>The Network Diagram is used to navigate complex database structures. It is a compact way to show the relationships between Relations (Tables) </li></ul>
    35. 35. Activities <ul><li>Consider the following relational database schemas. </li></ul><ul><li>Suppliers(suppId, name, street, city,state) </li></ul><ul><li>Part(partId,partName,weight,length,composition) </li></ul><ul><li>Products(prodId, prodName,department) </li></ul><ul><li>Supplies(partId,suppId) </li></ul><ul><li>Uses(partId,prodId) </li></ul><ul><li>Make reasonable assumptions about the meaning of attribute and relations, identify the primary and foreign keys and draw a network diagram showing the relations and foreign keys. </li></ul>
    36. 36. Answer Supplies Supplier Part Uses Product
    37. 37. <ul><li>Show the foreign keys on the network diagrams </li></ul><ul><li>Orders </li></ul><ul><li>Customer </li></ul><ul><li>SalesRep </li></ul><ul><li>Part </li></ul>Ordnum ordDate custNumb 12489 2/9/91 124 custNumb custName Address Balance credLim Slsnumber 124 Adams 48 oak st 418.68 500 3 Slsnumber Name address totCom commRate 3 Mary 12 Way 2150 .05 Part Desc onHand IT wehsNumb unitPrice AX12 Iron 1.4 HW 3 17.95
    38. 38. <ul><li>OrLine </li></ul>ordNum Part date quotePrice
    39. 39. Answer Orders OrLine Part Customer SalesRep SlsNumber CustNumb orLine Part
    40. 40. Activities <ul><li>What problems many arise from this table? </li></ul><ul><ul><li>What data redundancies are there? </li></ul></ul><ul><ul><li>What changes would you make? (hint make another table. </li></ul></ul><ul><ul><li>What if I wanted to search by surname? </li></ul></ul>
    41. 41. Activities <ul><li>What is wrong with this table? </li></ul>
    42. 42. Functional Dependence FDD
    43. 43. Functional Dependency Diagrams <ul><li>A FUNCTIONAL DEPENDENCY DIAGRAM is a way of </li></ul><ul><li>representing the structure of information needed to </li></ul><ul><li>support a business or organization </li></ul><ul><li>I t can easily be converted into a design for a relational </li></ul><ul><li>database to support the operations of the business. </li></ul>
    44. 44. Data Analysis and Database Design Using Functional Dependency Diagrams <ul><li>The steps of Data Analysis in FDD are </li></ul><ul><ul><li>1.1 Look for Data Elements </li></ul></ul><ul><ul><li>1.2 Look for Functional Dependencies </li></ul></ul><ul><ul><li>1.3 Represent Functional Dependencies in a diagram </li></ul></ul><ul><ul><li>1.4 Eliminate Redundant Functional Dependencies </li></ul></ul><ul><li>Data Design, after we have our final version of the FDD </li></ul><ul><ul><li>2.1 Apply the Synthesis Algorithm </li></ul></ul>
    45. 45. Starting points for drawing functional dependency diagrams <ul><li>We must Understand the data </li></ul><ul><li>We Examine forms, reports,data entry and output screens etc… </li></ul><ul><li>We Examine sample data </li></ul><ul><li>We consider Enterprise (business) rules </li></ul><ul><li>We examine narrative descriptions and conduct interviews. </li></ul><ul><li>We apply our Experiences/Practice and that of others </li></ul>To start the process of constructing our FDD we do the following:
    46. 46. Enterprise Rules <ul><li>What are Enterprise / Business Rules? </li></ul><ul><li>An enterprise rule (in the context of data analysis) is a </li></ul><ul><li>statement made by the enterprise (organisation, company, </li></ul><ul><li>officer in charge etc.) which constrains data in some way. </li></ul><ul><li>Functional dependencies are the most important type of </li></ul><ul><li>constraint on data and are often expressed in the form of </li></ul><ul><li>enterprise rules. </li></ul><ul><li> e.g </li></ul><ul><li>No two employees may have the same employee number. </li></ul><ul><li>An order is made by only one customer </li></ul><ul><li>An employee can belong to only one department at a time. </li></ul>
    47. 47. Drawing FDDs - Data Elements <ul><li>We often refer to Data Elements during the FDD process </li></ul><ul><li>A data element is a elementary piece of recorded information </li></ul><ul><li>Every data element has a unique name. </li></ul><ul><li>A data element is either a </li></ul><ul><ul><li>Label, e.g PersonName, Address, BulidingCode , or </li></ul></ul><ul><ul><li>Measurement, e.g. Height, Age, Date </li></ul></ul><ul><li>A data element must take values that can be written down. </li></ul>
    48. 48. Functional Dependency Diagrams Now we have the Database Design 2NF Relation 3NF Relation Universal Relation 1NF Tables ONF Using the Method of Decomposition Method of Synthesis Sample Data Eliminate Part Key Dependencies Eliminate Non Key Dependencies Eliminate Repeating Groups Attribute & Functional Dependencies Given the Problem Functional Dependency Diagram OR, here is the same process using the FDD approach
    49. 49. Data Element Examples <ul><li>Here are some examples </li></ul><ul><li>PersonName has values Jeff, Jill, Gio, Enid </li></ul><ul><li>Address has values 1 John St, 25 Rocky Road </li></ul><ul><li>Height has values 171cm, 195cm </li></ul><ul><li>Age has values 21,52,93,2 </li></ul><ul><li>Date has values 20 th May 1947, 2 nd March 1997 </li></ul><ul><li>JobName has values Manager, Secretary, Clerk </li></ul><ul><li>Manager might not be a data element, but </li></ul><ul><li>ManagerName could be. It could be a value of another data element e.g. JobName </li></ul>
    50. 50. Drawing FDDs Data Elements <ul><li>Start drawing the Functional Dependency Diagram by </li></ul><ul><li>representing the Data Elements. A Data Element is </li></ul><ul><li>represented by its name placed in a box: </li></ul><ul><li>Every data element must have a unique name in the </li></ul><ul><li>functional dependency diagram. </li></ul><ul><li>A data element cannot be composed of other data elements i.e. </li></ul><ul><li>it cannot be broken down into smaller components </li></ul><ul><li>A Data Element is also known as an ATTRIBUTE , because it generally describes a property of some thing which we will later call an ENTITY </li></ul>Data Element
    51. 51. <ul><li>A functional Dependency is a relationship between Attributes. </li></ul><ul><li>It is shown as an arrow e.g A B </li></ul><ul><li>It means that for every value of A , there is only one value for B </li></ul><ul><li>It reads “ A determines B ”. </li></ul><ul><li>A is called a determinant attribute. </li></ul><ul><li>B is called the dependent attribute. </li></ul>Drawing FDDs –Using Elements
    52. 52. Data Element Examples Surname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . On a form gives rise to the element CREDIT CARD Bankcard Mastercard Visa Other CreditCardType Surname Here are some examples of finding the Data Elements on a typical form On a form gives rise to the element
    53. 53. Functional Dependency Examples Students and their family names “ Each student (identified by student number) has only one family name” Considering the rules stated above we should be able to draw a FDD for this. What are the elements of interest? Students FamilyName 1 Smith 2 Jones 3 Smith 4 Andrews
    54. 54. FDDs Answer Students determine FamilyName (or FamilyName depends on Students) Each student has exactly one family name, but the name could be the name of many students. So FamilyName does not determine Student# e.g. “Smith is the name of students 1 and 3 Students FamilyName Data elements of interest are Student# and FamilyName. Students FamilyName 1 Smith 2 Jones 3 Smith 4 Andrews
    55. 55. FDDs Examples Employees and the departments they work for. In this example the tables are representing some interesting data of the business. We see that Employees with the ID numbers 11,2 and 31 all work in the Accounting Dept and that Employees with the ID numbers 45 and 27 work in the Sales Dept. Do you think that you could draw an FDD to represent this? Have a go and then check your answers Enterprise Rule: “Each employee works on only one department” Department Name Accounting Employee Number 11 2 31 Department Name Sales Employee Number 45 27
    56. 56. FDD Answers Employees and the departments they work for. Data elements of interest are Employee# and DeptName” Employee# DeptName So we could make this following Table Department Name Accounting Employee Number 11 2 31 Department Name Sales Employee Number 45 27 Employee# DeptName 11 Acc 2 Acc 45 Sales 31 Acc 27 Acc
    57. 57. FDDs Examples The quantity of parts held in a warehouse and their suppliers Part# determines SupplierName & Part# determines QOH “ Parts are uniquely identified by part numbers” “ Suppliers are uniquely identified by Supplier Names” “ A part is supplied by only one supplier” “ A part is held in only one quantity” Parts SupplierName Parts QOH Should QOH be a determinant? No, common sense tells us that is not a reliable choice. We could have had repeating values Parts Suppliers Name QOH 1 Wang Electronics 23 2 Cumberland Enterprises 80 3 Wang Electronics 4 4 Roscoe Pty. Ltd 58
    58. 58. FDDs Examples Students and their subjects enrolled. “ Each student is given a unique student number” “ A subject is uniquely identified by its name” “ A student may choose several subjects” Data element of interest are Student# and SubjectName Student SubjectName There us no functional dependency here. Student# does not determine SubjectName, nor does SubjectName determine Student# Student SubjectName 1 History 1 Geography 1 Mathematics 1 History 2 English 2 English 3 Mathematics 3 English 4 French 4 Geography
    59. 59. FDDs Examples Results obtained by each student for each subject. “ Each student is given a unique student number” “ A subject is uniquely identified by its name” “ A student may choose several subjects” “ A student is allocated a result for each subject” “ Each student has only one name.” Data elements are Student#, StudentName, SubjectName and Grade
    60. 60. FDDs Examples Results obtained by each student for each subject. Try and construct an FDD for this table considering the given Business Rules and the Data Elements Student Student Name Subject Name Grade 1 Smith History A 1 Smith Geography B 1 Smith Mathematics A 2 Jones History C 2 Jones English C 3 Smith English A 3 Smith Mathematics A 4 Andrews English D 4 Andrews French C 4 Andrews Geography C
    61. 61. FDDs Examples Results obtained by each student for each subject. Student # StudentName We can see that there is only one and only one student name for each student number, even though there might be more than one student with the same name. So…. But the subject grade for any student cannot be determined by the subject name or the student# by itself. A student can have many grades depending on the subject. How can we cater for this?
    62. 62. FDDs Answer Results obtained by each student for each subject. Student SubjectName Grade StudentName This is called the Composite Determinant We need to combine the two Elements to say that there is one and only one grade for a student doing a particular subject. Here then is the complete diagram
    63. 63. FDDs Examples Customer Orders Validating functional dependencies Using simple data and populating the table, check there is only one value of the dependent. Order Part# CustomerName Address 454 12 David Smith 1 John St, Hawthorn 454 23 David Smith 1 John St, Hawthorn 455 32 Emily Jones 45 Grattan St, Parkville 455 49 Emily Jones 45 Grattan St, Parkville 455 54 Emily Jones 45 Grattan St, Parkville 456 12 Mary Ho 44 Park St, Hawthorn 456 54 Mary Ho 44 Park St, Hawthorn
    64. 64. FDDs Examples “ Orders is uniquely identified by its names” “ Customers are uniquely identified by their names” “ A customer has only one address” “ An order belongs to only one customer” “ A part may be ordered only once one each order” Order CustomerName Address Part# Order Parts Ordered CustomerName Address 454 23, 12 David Smith 1 John St, Hawthorn 455 54, 49, 32 Emily Jones 45 Grattan St, Parkville 456 54, 12 Mary Ho 44 Park St, Hawthorn
    65. 65. FDDs Examples Employees and their tax files numbers “ Each employee has a unique employee number” “ Each employee has a unique tax file number ” Employee# determines taxfile# Taxfile# determines Employee# Alternative keys Employee TaxFile# 1 1024-5321 2 3456-3294 3 8246-7106 4 8861-6750 5 1234-4765 Employee# Taxfile# Employee# Taxfile# Taxfile# Employee#
    66. 66. <ul><li>Obtain Tutorial 1 from your tutor. </li></ul>
    67. 67. Functional Dependency Diagrams Database Design Let’s look at the process of converting the FDD into a schema. We have a 12 step process to do so, that has an iterative component to it (loop). The 12 steps are outlined in the next series of slides.
    68. 68. Functional Dependency Diagram Preparation 1. Represent each data element as a box. 2. Represent each functional dependency by an arrow. 3. Eliminate augmented dependencies. 4. Eliminate transitive dependencies. 5. Eliminate pseudo-transitive dependencies.   By this stage, intersecting attributes should have been eliminated.
    69. 69. Deriving 3NF Schema: Synthesis Algorithm 6. Pick any (unmarked) arrow in the diagram. 7. Follow it back to its source, and write down the name of the source. S 8 . Follow all arrows from the source data item, and write down the names of their destinations . S, A, B, C S is now the key of a 3NF relation ( S , A, B, C). S S A B C
    70. 70. Synthesis Algorithm : Deriving 3NF Schema 9. Mark all the arrows just processed. 10. If there are any unmarked arrows in the diagram, go back to step 6. 11. Finally, determine the Universal Key. Any attribute which is not determined by any other attribute (ie. has no arrow going into it) is part of the Universal Key. 12. If the universal key is not already contained in any of the above relations, make it into a relation. The universal key is the key of the new relation.
    71. 71. A Fully Worked Example <ul><li>We will now work from a given set of forms to produce an FDD then use the 12 steps to produce the Schema. The forms that follow show the time spent by a particular employee on a particular project. They contain details of the employee along with details of the project. In addition they also state the hours that the employee has spent on any one project to date. This is important to the FDD. Notice also that the employee can have many previous titles and have a number of skills. This also has to be dealt with in the FDD and then later after we have used the synthesis technique to create the Schema. Have a good look at the forms on the next 2 slides and try to develop the FDD yourself. </li></ul>
    72. 72. EMPLOYEE ______________________________________________________________________________________________________________ NAME E_NUMBER DEPARTMENT LOCATION CURRENT TITLE PRIOR_TITLES SKILLS_ ______________________________________________________________________________________________________________ Adams 1001 Finance 9th Floor Senior consultant Junior consultant Stock market Research analyst Investments ______________________________________________________________________________________________________________ PROJECTS ______________________________________________________________________________________________________________ NAME TIME_SPENT P_NUMBER MANAGER ACTUAL_COST EXPECTED_COST ______________________________________________________________________________________________________________ Resolve bad debts 35 26713 Kanter 2000 1500 ______________________________________________________________________________________________________________ We say that this table is in “zero normal form” ( 0NF ) This is because the cells have multiple values, eg. Prior titles and Skills. The next slide shows forms that demonstrate that an employee can work on many projects. Personnel Database Forms 1
    73. 73. EMPLOYEE __________________________________________________________________________________________________________ NAME E_NUMBER DEPARTMENT LOCATION CURRENT TITLE PRIOR_TITLES SKILLS __________________________________________________________________________________________________________ Baker 1002 Finance 9th Floor Senior consultant Junior consultant Stock market Research analyst _________________________________________________________________________________________________________________ _____ PROJECTS __________________________________________________________________________________________________________ NAME TIME_SPENT P_NUMBER MANAGER _NUM ACTUAL_COST EXPECTED_COST __________________________________________________________________________________________________________ Res bad debts 18 26713 Kanter 2000 1500 __________________________________________________________________________________________________________ ________________________________________________________________________________________________________________ EMPLOYEE _________________________________________________________________________________________________________ NAME E_NUMBER DEPARTMENT LOCATION CURRENT TITLE PRIOR_TITLES SKILLS _________________________________________________________________________________________________________ Clarke 1003 Accounting 8th Floor Senior consultant Junior consultant Stock market Investments _________________________________________________________________________________________________________ PROJECTS _________________________________________________________________________________________________________ NAME TIME_SPENT P_NUMBER MANAGER _NUM ACTUAL_COST EXPECTED_COST _________________________________________________________________________________________________________ New billing system 26 23760 Yates 1000 10000 New office lease 10 26511 Yates 5000 5000 ___________________________________________________________________________________________________________________________ Personnel Database Forms 2
    74. 74. <ul><li>TIME_SPENT </li></ul>EXPECTED_COST Personnel Database FD Diagram LOCATION ACTUAL_COST MANAGER _NUM PROJECT_NAME P_NUMBER CURRENT_TITLE E_NUMBER EMPLOYEE_NAME PRIOR_TITLE SKILL DEPARTMENT_NAME From the forms given we can produce the following FDD
    75. 75. EXPECTED_COST Personnel Database FD Diagram -Synthesis ACTUAL_COST MANAGER _NUM PROJECT_NAME P_NUMBER Let us just consider the section of the FDD that looks at the project number as the determinant By using the synthesis method we can choose an arrow, trace it back to the source, and gather together all of the attributes that the source points to. Try this and see if you can create the schema for this table.
    76. 76. LOCATION DEPARTMENT_NAME Personnel Database FD Diagram - Synthesis So the table DEPT ( DEPARTMENT_NAME , LOCATION) is created Again, if we choose another arrow that has not been chosen before and follow it back to the determinant we find DEPARTMENT_NAME is a determinant. Gathering all of the attributes that it points to we only have the location attribute. Hence this is a simple table consisting of DEPARTMENT_NAME as the Primary key and LOCATION as the only other attribute.
    77. 77. Personnel Database FD Diagram - Synthesis CURRENT_TITLE E_NUMBER EMPLOYEE_NAME DEPARTMENT_NAME EMPLOYEE (EMPLOYEE_NAME, E_NUMBER, DEPARTMENT, CURRENT TITLE ) Likewise for the section of the FDD based around the E_NUMBER, creating the following table for the Employees details.
    78. 78. <ul><li>TIME_SPENT </li></ul>P_NUMBER E_NUMBER Personnel Database FD Diagram - Synthesis Try to create the Assignment table for this part of the FDD.When you think you have it have a look at ours and see if you are right. Here we have a slightly more complicated one. The Time spent on the project is dependent on both the Project number and the Employee name, as it is the time spent by a particular employee on a particular project. This is demonstrated by the boxing of both the above attributes together pointing to the TIME_SPENT
    79. 79. <ul><li>TIME_SPENT </li></ul>P_NUMBER E_NUMBER Personnel Database FD Diagram - Synthesis ASSIGNMENT ( E_NUMBER, P_NUMBER, TIME_SPENT) The main difference here is that when choosing the arrow to follow back to the determinant we find that we have 2. This is OK, we just have to make sure that in the table both of them are the primary Key. We have a Composite Primary Key consisting P_NUMBER and E_NUMBER. When we then gather up all of the attributes that they point to together we get TIME_SPENT. Hence the table is written as See the composite primary key
    80. 80. P_NUMBER E_NUMBER PRIOR_TITLE SKILL UK ( E_NUMBER, P_NUMBER, PRIOR_TITLE, SKILL) Personnel Database FD Diagram - Universal Key Now, the last part of the synthesis is often forgotten. We must collect up all of the attributes that do not have arrows pointing into them and place them in the one table called the Universal Key. Every attribute collected then becomes part of the composite Primary Key. In this case we have the following attributes inside the box below. Notice how Skill is there, as it sits by itself. Nothing is its determinant.
    81. 81. Foreign Keys <ul><li>In the Synthesis Algorithm, a foreign key will arise from any attribute that is: </li></ul><ul><ul><li>both a determinant and part of another determinant, OR </li></ul></ul><ul><ul><li>both a determinant and a dependent. </li></ul></ul>TIME_SPENT LOCATION P_NUMBER E_NUMBER DEPARTMENT_NAME ASSIGNMENT ( E_NUMBER, P_NUMBER, TIME_SPENT) EMPLOYEE ( E_NUMBER, DEPARTMENT_NAME) DEPT ( DEPARTMENT_NAME , LOCATION) A. B.
    82. 82. ISA = Is A <ul><li>Every MANAGER value is a E_NUMBER value. </li></ul><ul><li>Gives rise to a new Foreign Key </li></ul>In the case of the manager we say that the manager number is contained within the employee number MANAGER_NUM E_NUMBER ISA EMPLOYEE PROJECT MANAGER _NUM
    83. 83. <ul><li>ASSIGNMENT ( E_NUMBER, P_NUMBER, TIME_SPENT) </li></ul>EMPLOYEE (NAME, E_NUMBER, DEPARTMENT, CURRENT TITLE ) PROJECT (NAME, P_NUMBER, MANAGER _ NUM, ACTUAL_COST, EXPECTED_COST ) Personnel Database Schema Generated by Synthesis DEPT ( DEPARTMENT , LOCATION) UK ( E_NUMBER, P_NUMBER, PRIOR_TITLE, SKILL) This foreign key is a result of MANAGER ISA E_NUMBER
    84. 84. <ul><li>ASSIGNMENT </li></ul>EMPLOYEE PROJECT UK Personnel Database Network Diagram Generated by Synthesis E_NUMBER + P_NUMBER P_NUMBER E_NUMBER DEPT DEPARTMENT_NAME MANAGER_NUM
    85. 85. A Fully Worked Example We now have to take care of the multi-valued areas such as skills and prior titles. Our FDD synthesis takes care of everything up to that. It converts the FDD to what we call “Third normal Form”. We know that an individual can have many skills and many Prior Titles. They can also work on many Projects. Knowing the Employee number will not tell us one and only one value of the Skills that they have. We show this on the extended FDD with a double arrow notation.The notation for such a relationship is shown here where E_NUMBER is a determinant for many values of skill. Consequently the resulting representation shown on the next slide can be constructed, giving rise to the splitting of the UK to form three more relations E_NUMBER SKILL
    86. 86. E_NUMBER PRIOR_TITLE SKILL MVDs PRIOR_JOB ( E_NUMBER, PRIOR_TITLE ) EXPERTISE ( E_NUMBER, SKILL) Personnel Database Multivalued Dependency-Decomposition P_NUMBER, ASSIGN ( E_NUMBER, P_NUMBER) MultiValued Dependency Employees are associated with Projects, Titles and Skills independently. There is no direct relationship between Projects, Titles and Skills. Hence we have the three new relations ASSIGN, PRIOR_JOB and EXPERTISE
    87. 87. <ul><li>TIME_SPENT </li></ul>EXPECTED_COST Personnel Database FD Diagram with MVDs and Inclusion LOCATION ACTUAL_COST MANAGER _NUM PROJECT_NAME P_NUMBER CURRENT_TITLE E_NUMBER EMPLOYEE_NAME PRIOR_TITLE SKILL ISA MVD DEPARTMENT_NAME MVD
    88. 88. <ul><li>ASSIGNMENT ( E_NUMBER, P_NUMBER, TIME_SPENT) </li></ul><ul><li>PRIOR_JOB ( E_NUMBER, PRIOR_TITLE ) </li></ul><ul><li>EXPERTISE ( E_NUMBER, SKILL) </li></ul>EMPLOYEE (NAME, E_NUMBER, DEPARTMENT, CURRENT TITLE ) PROJECT (NAME, P_NUMBER, MANAGER, ACTUAL_COST, EXPECTED_COST ) Final Personnel Database Schema DEPT ( DEPARTMENT , LOCATION) Decomposed from UK
    89. 89. <ul><li>ASSIGNMENT </li></ul>EMPLOYEE PROJECT PRIOR_JOB EXPERTISE Final Personnel Database Network Diagram E_NUMBER P_NUMBER E_NUMBER E_NUMBER DEPT DEPARTMENT_NAME MANAGER _NUM
    90. 90. EXPECTED_COST Personnel Database FD Diagram - Synthesis ACTUAL_COST MANAGER PROJECT_NAME P_NUMBER PROJECT (PROJECT_NAME, P_NUMBER, MANAGER, ACTUAL_COST, EXPECTED_COST ) Choosing any of the arrows and following it back leads you to the project number ( P_Number ). This is then the Primary Key . If you then gather all of the attributes that P_Number points to and place them in the brackets you get the table Project with P_Number as the primary Key .
    91. 91. Role Splitting In Functional Dependency Diagrams <ul><li>In a Functional Dependency Diagram any group of attributes can be related in only one way. </li></ul><ul><ul><li>For example, a pair of attributes can be related by an FD or not. </li></ul></ul><ul><li>Sometimes data can be related in more one way. </li></ul><ul><ul><li>For example, a department can have an employee as its head or as a member. </li></ul></ul><ul><ul><li>The member relationship is represented in the FDD: </li></ul></ul><ul><ul><li>But the head relationship is represented in the FDD: </li></ul></ul>E_NUMBER DEPARTMENT_NAME DEPARTMENT_NAME E_NUMBER
    92. 92. Role Splitting In Functional Dependency Diagrams <ul><li>We can choose to split the E_NUMBER attribute into E_NUMBER and HOD . </li></ul><ul><li>But the foreign key constraint that a Head of Department is an Employee is lost on the FDD. </li></ul>E_NUMBER DEPARTMENT_NAME HOD ISA EMPLOYEE DEPT FDD NetworkD DEPARTMENT_NAME HOD Synthesis
    93. 93. Role Splitting In FDD s <ul><li>Alternatively, we can choose to split the DEPARTMENT_NAME attribute into EMPLOYING_DEPT and HEADED_DEPT . </li></ul><ul><li>But the foreign key constraint that an Employing Department must be a Headed Department is again lost on the FDD. </li></ul>E_NUMBER EMPLOYING_DEPT HEADED_DEPT ISA EMPLOYEE DEPT FDD NetworkD EMPLOYING_DEPT E_NUMBER Synthesis
    94. 94. Role Splitting Example Consider this example. We have the Employee with many Skills, Prior Titles, as before but we also have equipment that belongs to a particular employee, such as a computer and a fax. An employee can have many different pieces of equipment. It is worthwhile recognizing them on the diagram and then decomposing them into smaller relations as part of the schema
    95. 95. LOCATION CURRENT_TITLE E_NUMBER EMPLOYEE_NAME PRIOR_TITLE SKILL DEPARTMENT_NAME SERIAL# DESCRIPTION UK <ul><li>MVDs not necessarily embodied in the UK. </li></ul><ul><li>Better to decompose on MVDs first. </li></ul><ul><li>MVDs partition attributes into independent sets. </li></ul>HOD ISA MVDs Suppose each item of equipment (identified by SERIAL#) belongs to an employee.
    96. 96. <ul><li>Obtain Tutorial 2 from your tutor. </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×