2009/03/04. 資料庫 Database Database: A collection of related data. A databse is nothing more...

23
2009/03/ 04

Transcript of 2009/03/04. 資料庫 Database Database: A collection of related data. A databse is nothing more...

  • 2009/03/04

  • DatabaseDatabase:

    A collection of related data.

    A databse is nothing more than a collection of information that exists over a long period of time

    Data + Semantic = information

  • Data modelingA data model provides users with a conceptual representation of data that does not include many of the details of how the data is stored Data abstraction Object Definition LanguageE/R modelRelationsRelational databaseObject oriented database

  • Class Star { attribute string name; attribute Struct Addr { string street; string city; } relationship Set starredIn inverse Movie::stars } MoviesStarsInStarstitleyearlengthfilmtypetitletitleObject Definition LanguageE/R model

  • E/R (Entity-relationship)modelEntity (Object- a thing in the real world with an independent existenceRelationship relationships between entities

    instancesattributesEntityRelation

  • Dimensionality of relation

  • Dimensionality of data cube

  • Relationship degreeEmployeeWorkforDepartmentDegree of 2DepartmentWorkforEmployee

  • Relationship degreeProjectSupplyPartSupplier

  • SupplierSupplyProjectDegree of 3Part

  • Constraint type of 1:1 relationshipDepartmentManagesEmployeeEmployeeManagesDepartment11

  • Constraint type of N:1 relationshipDepartment(1,1)EmployeeEmployeeWorkforDepartmentN1Workfor(2,N)

  • Constraint type of 1:N relationshipDependent(0,N)EmployeeEmployee1N(1,1)DependentOfDependentOfDependent

  • Constraint type of 1:N relationshipProject(0,N)DepartmentDepartment1N(1,1)ControlControlProject

  • Constraint type of N:M relationshipDepartmentWorkforEmployeeEmployeeWorkforDepartmentNM(1,N)(2,N)

  • Constraint type of N:M relationshipProjectWorkOnEmployeeEmployeeWorkforDepartmentNM(1,N)(2,N)

  • ProjectSupplyPartSupplierConstraint type of N:M relationship

  • SupplierSupplyProjectPart

  • E-R diagram for the company schemaEmployeeWorkforDepartment(1,1)(4,N)Manages(0,1)(1,1)ProjectControlWorks_onDependentsDependents ofnameFnameLnamesexssnRelationshipName(1,N)(1,N)(1,1)(0,N)(0,N)(1,1)StartDateNameLocationsSexBirthdayNumberHoursNumberNameLocations(1,N)

  • E-R diagram for the company schemaEmployeeWorkforDepartmentN1Manages11ProjectControlWorks_onDependentsDependents ofnameFnameLnamesexssnRelationshipNameMNN11NStartDateNameLocationsSexBirthdayNumberHoursNumberNameLocations

  • An example of a simple relational database

  • External viewExternal viewConceptual SchemaInternal SchemaExternal LevelConceptual LevelInternal LevelThree-schema architecture