SlideShare uma empresa Scribd logo
1 de 50
Introduction to  Database Design July 2005 Ken Nunes knunes @ sdsc.edu
Database Design Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
General Design Considerations ,[object Object],[object Object],[object Object]
Users ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Legacy Systems/Data ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Application Requirements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Entity - Relationship Model ,[object Object],[object Object],[object Object],[object Object],[object Object]
Entities ,[object Object],[object Object],Employee Department
Attributes ,[object Object],[object Object],Name SSN Employee Department Name Budget
Relationships ,[object Object],[object Object],Name SSN Employee Department Name Budget works in Start date
Relationship Connectivity ,[object Object],[object Object],[object Object],Name SSN Employee Department Name Budget work 1 N Start date
Connectivity Department Manager has 1 1 Department Project has N 1 Employee Project works on N M one-to-one one-to-many many-to-many
ER example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Team Entities & Attributes ,[object Object],[object Object],[object Object],Players Sales Start date End date Statistics Name tickets merchandise Games opponent date result
Team Relationships ,[object Object],[object Object],[object Object],Players Games N 1 play
Team Relationships ,[object Object],[object Object],[object Object],Games Sales generates  1 1
Team ER Diagram Players Games Sales play  generates  N 1 1 1 Start date End date Statistics Name tickets merchandise opponent date result
Logical Design to Physical Design ,[object Object],[object Object],[object Object]
Entity tables Transform each entity into a table with a key and its attributes. Name SSN Employee create table  employee (emp_no number, name varchar2(256), ssn number, primary key  (emp_no));
Foreign Keys ,[object Object],[object Object],create table  employee (emp_no number, dept_no number, name varchar2(256), ssn number, primary key (emp_no), foreign key  (dept_no) references department); Employee Department has  1 N create table  department (dept_no number, name varchar2(50), primary key  (dept_no));
Foreign Key Department Employee Accounting has 1 employee: Brian Burnett Human Resources has 2 employees: Nora Edwards Ben Smith IT has 3 employees: Ajay Patel John O’Leary Julia Lenin
Many-to-Many tables ,[object Object],[object Object],create table  proj_has_emp (proj_no number, emp_no number, start_date date, primary key  (proj_no, emp_no), foreign key  (proj_no) references project foreign key  (emp_no) references employee); Employee Project has  N M Start date
Many-to-Many tables Project Employee proj_has_emp Employee Audit has 1 employee: Brian Burnett Budget has 2 employees: Julia Lenin Nora Edwards Intranet has 3 employees: Julia Lenin John O’Leary Ajay Patel
Tutorial ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tutorial ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tutorial ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Normalization ,[object Object],[object Object],[object Object]
First Normal Form (1NF) ,[object Object],[object Object],[object Object],[object Object],[object Object]
1NF Employee  (unnormalized) Employee (1NF)
Second Normal Form (2NF) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Functional Dependence Name, dept_no, and dept_name are functionally dependent on emp_no.  (emp_no -> name, dept_no, dept_name) Skills is not functionally dependent on emp_no since it is not unique to each emp_no. Employee (1NF)
2NF Employee (1NF) Employee (2NF) Skills (2NF)
Data Integrity ,[object Object],[object Object],[object Object],Employee (1NF)
Third Normal Form (3NF) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Transitive Dependence Dept_no and dept_name are functionally dependent on emp_no however, department can be considered a separate entity. Employee (2NF)
3NF Employee (2NF) Employee (3NF) Department (3NF)
Other Normal Forms ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Normalizing our team (1NF) players games sales
Normalizing our team (2NF & 3NF) players games sales player_stats
Revisit team ER diagram games sales generates  1 1 tickets merchandise opponent date result player_stats tracked  Recorded by  1 N N aces blocks digs players Start date End date Name 1 spikes
Star Schemas ,[object Object],[object Object],[object Object],[object Object],[object Object]
Fact Table ,[object Object],[object Object],[object Object],Invoice Facts units sold unit amount total sale price
Dimension Table ,[object Object],[object Object],Customer Dimension cust_dim_key name address phone Time Dimension time_dim_key invoice date due date delivered date Location Dimension loc_dim_key store number store address store phone Product Dimension prod_dim_key product price cost
Star Schema The fact table forms a one to many relationship with each dimension table.  Customer Dimension cust_dim_key name address phone Time Dimension time_dim_key invoice date due date delivered date Location Dimension loc_dim_key store number store address store phone Product Dimension prod_dim_key product price cost Invoice Facts cust_dim_key loc_dim_key time_dim_key prod_dim_key units sold unit amount total sale price 1 1 1 1 N N N N
Analyzing the team Team Facts date merchandise tickets ,[object Object],[object Object]
Team Dimension Player Dimension player_dim_key name start_date end_date aces blocks spikes digs We have 2 dimensions for the schema: player and games. Game Dimension game_dim_key opponent result
Team Star Schema Player Dimension player_dim_key name start_date end_date aces blocks spikes digs Team Facts player_dim_key game_dim_key date merchandise tickets 1 N Game Dimension game_dim_key opponent result 1 N
Books and Reference ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Continuing Education ,[object Object],[object Object],[object Object],[object Object]
Data Central ,[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados (20)

Sql
SqlSql
Sql
 
Coit11237 assignment 2 specifications
Coit11237 assignment 2 specificationsCoit11237 assignment 2 specifications
Coit11237 assignment 2 specifications
 
003.query
003.query003.query
003.query
 
5-A Reading
5-A Reading5-A Reading
5-A Reading
 
CIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.comCIS 336 Wonderful Education--cis336.com
CIS 336 Wonderful Education--cis336.com
 
Data Analytics Using MS Excel
Data Analytics Using MS ExcelData Analytics Using MS Excel
Data Analytics Using MS Excel
 
Sql ch 12 - creating database
Sql ch 12 - creating databaseSql ch 12 - creating database
Sql ch 12 - creating database
 
E-Book 25 Tips and Tricks MS Excel Functions & Formulaes
E-Book 25 Tips and Tricks MS Excel Functions & FormulaesE-Book 25 Tips and Tricks MS Excel Functions & Formulaes
E-Book 25 Tips and Tricks MS Excel Functions & Formulaes
 
SQL
SQLSQL
SQL
 
Excel 2007 Unit A
Excel 2007 Unit AExcel 2007 Unit A
Excel 2007 Unit A
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
 
Chapter.03
Chapter.03Chapter.03
Chapter.03
 
Chapter.02
Chapter.02Chapter.02
Chapter.02
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
Chap 7
Chap 7Chap 7
Chap 7
 
Sample Excel 2013 Advanced Essentials
Sample Excel 2013 Advanced EssentialsSample Excel 2013 Advanced Essentials
Sample Excel 2013 Advanced Essentials
 
Microsoft excel 2010 useful formula & functions
Microsoft excel 2010   useful formula & functionsMicrosoft excel 2010   useful formula & functions
Microsoft excel 2010 useful formula & functions
 
MS Excel
MS ExcelMS Excel
MS Excel
 
Advanced excel 2010 & 2013 updated Terrabiz
Advanced excel 2010 & 2013 updated TerrabizAdvanced excel 2010 & 2013 updated Terrabiz
Advanced excel 2010 & 2013 updated Terrabiz
 
Excel training by rajesh p
Excel training by rajesh pExcel training by rajesh p
Excel training by rajesh p
 

Semelhante a Nunes database

Preparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dPreparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dGihan Wikramanayake
 
A2 databases
A2 databasesA2 databases
A2 databasesc.west
 
Project Management System
Project Management SystemProject Management System
Project Management SystemDivyen Patel
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database ModelsPrithwis Mukerjee
 
Er to tables
Er to tablesEr to tables
Er to tablesGGCMP3R
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.pptComputer57
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxhoney690131
 
Kevin Fahy Bi Portfolio
Kevin Fahy   Bi PortfolioKevin Fahy   Bi Portfolio
Kevin Fahy Bi PortfolioKevinPFahy
 
Cis336 i lab 1 of 7
Cis336 i lab 1 of 7Cis336 i lab 1 of 7
Cis336 i lab 1 of 7helpido9
 
Introduction to Dimesional Modelling
Introduction to Dimesional ModellingIntroduction to Dimesional Modelling
Introduction to Dimesional ModellingAshish Chandwani
 
Difference between fact tables and dimension tables
Difference between fact tables and dimension tablesDifference between fact tables and dimension tables
Difference between fact tables and dimension tablesKamran Haider
 

Semelhante a Nunes database (20)

SA Chapter 10
SA Chapter 10SA Chapter 10
SA Chapter 10
 
Preparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dPreparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001d
 
Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 
A2 databases
A2 databasesA2 databases
A2 databases
 
Project Management System
Project Management SystemProject Management System
Project Management System
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 
Er to tables
Er to tablesEr to tables
Er to tables
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 
Dimensional Modelling
Dimensional ModellingDimensional Modelling
Dimensional Modelling
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
 
Kevin Fahy Bi Portfolio
Kevin Fahy   Bi PortfolioKevin Fahy   Bi Portfolio
Kevin Fahy Bi Portfolio
 
Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
 
Topics-Ch4Ch5.ppt
Topics-Ch4Ch5.pptTopics-Ch4Ch5.ppt
Topics-Ch4Ch5.ppt
 
Cis336 i lab 1 of 7
Cis336 i lab 1 of 7Cis336 i lab 1 of 7
Cis336 i lab 1 of 7
 
Introduction to Dimesional Modelling
Introduction to Dimesional ModellingIntroduction to Dimesional Modelling
Introduction to Dimesional Modelling
 
Database Basics
Database BasicsDatabase Basics
Database Basics
 
ITB - UNIT 4.pdf
ITB - UNIT 4.pdfITB - UNIT 4.pdf
ITB - UNIT 4.pdf
 
Difference between fact tables and dimension tables
Difference between fact tables and dimension tablesDifference between fact tables and dimension tables
Difference between fact tables and dimension tables
 

Nunes database

  • 1. Introduction to Database Design July 2005 Ken Nunes knunes @ sdsc.edu
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Connectivity Department Manager has 1 1 Department Project has N 1 Employee Project works on N M one-to-one one-to-many many-to-many
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Team ER Diagram Players Games Sales play generates N 1 1 1 Start date End date Statistics Name tickets merchandise opponent date result
  • 18.
  • 19. Entity tables Transform each entity into a table with a key and its attributes. Name SSN Employee create table employee (emp_no number, name varchar2(256), ssn number, primary key (emp_no));
  • 20.
  • 21. Foreign Key Department Employee Accounting has 1 employee: Brian Burnett Human Resources has 2 employees: Nora Edwards Ben Smith IT has 3 employees: Ajay Patel John O’Leary Julia Lenin
  • 22.
  • 23. Many-to-Many tables Project Employee proj_has_emp Employee Audit has 1 employee: Brian Burnett Budget has 2 employees: Julia Lenin Nora Edwards Intranet has 3 employees: Julia Lenin John O’Leary Ajay Patel
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. 1NF Employee (unnormalized) Employee (1NF)
  • 30.
  • 31. Functional Dependence Name, dept_no, and dept_name are functionally dependent on emp_no. (emp_no -> name, dept_no, dept_name) Skills is not functionally dependent on emp_no since it is not unique to each emp_no. Employee (1NF)
  • 32. 2NF Employee (1NF) Employee (2NF) Skills (2NF)
  • 33.
  • 34.
  • 35. Transitive Dependence Dept_no and dept_name are functionally dependent on emp_no however, department can be considered a separate entity. Employee (2NF)
  • 36. 3NF Employee (2NF) Employee (3NF) Department (3NF)
  • 37.
  • 38. Normalizing our team (1NF) players games sales
  • 39. Normalizing our team (2NF & 3NF) players games sales player_stats
  • 40. Revisit team ER diagram games sales generates 1 1 tickets merchandise opponent date result player_stats tracked Recorded by 1 N N aces blocks digs players Start date End date Name 1 spikes
  • 41.
  • 42.
  • 43.
  • 44. Star Schema The fact table forms a one to many relationship with each dimension table. Customer Dimension cust_dim_key name address phone Time Dimension time_dim_key invoice date due date delivered date Location Dimension loc_dim_key store number store address store phone Product Dimension prod_dim_key product price cost Invoice Facts cust_dim_key loc_dim_key time_dim_key prod_dim_key units sold unit amount total sale price 1 1 1 1 N N N N
  • 45.
  • 46. Team Dimension Player Dimension player_dim_key name start_date end_date aces blocks spikes digs We have 2 dimensions for the schema: player and games. Game Dimension game_dim_key opponent result
  • 47. Team Star Schema Player Dimension player_dim_key name start_date end_date aces blocks spikes digs Team Facts player_dim_key game_dim_key date merchandise tickets 1 N Game Dimension game_dim_key opponent result 1 N
  • 48.
  • 49.
  • 50.

Notas do Editor

  1. Name and level of experience with topic.
  2. Name and level of experience with topic.
  3. Entities denote people, places, things, or event of informational interest. Nouns. Entities should contain descriptive information.
  4. Entities denote people, places, things, or event of informational interest. Nouns. Entities should contain descriptive information.
  5. Provide details about the entities, Entity of person, attribute is name, hair color
  6. Each department can have multiple employees.
  7. Each department can have multiple employees.
  8. Provide details about the entities, Entity of person, attribute is name, hair color
  9. Provide details about the entities, Entity of person, attribute is name, hair color
  10. Provide details about the entities, Entity of person, attribute is name, hair color
  11. Provide details about the entities, Entity of person, attribute is name, hair color
  12. Teragrid: ssh user@tg-login.sdsc.teragrid.org Echo $DB2INSTANCE -> null then run: soft add +db2 db2
  13. List database directory Get authorizations List tables for schema <user>
  14. List database directory Get authorizations List tables for schema <user>
  15. Accomplish normalization by analyzing the interdependencies among attributes in tables and taking subsets of larger tables to form smaller ones. The subsets are created from examining the interdependencies among the table attributes.
  16. Note, dept_name is functionally dependent on dept_no. Dept_no is functionally dependent on emp_no, so via the middle step of dept_no, dept_name is functionally dependent on emp_no. (emp_no -> dept_no , dept_no -> dept_name, thus emp_no -> dept_name)
  17. which provides an intuitive schema for querying information.