1 / 24

Database

Database. Basic Definitions. Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation and maintenance of a computerized database.

Télécharger la présentation

Database

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database

  2. Basic Definitions • Database: A collection of related data. • Database Management System (DBMS): A software package/ system to facilitate the creation and maintenance of a computerized database. • Database System: The DBMS software together with the data itself. Sometimes, the applications are also included. ( Software + Database )

  3. Relational Database

  4. Data Models • High Level or Conceptual data models provide concepts that are close to the way many users perceive data, entities, attributes and relationships. (Ex. ERD) • Physical data models describes how data is stored in the computer and the access path needed to access and search for data.

  5. Entity Relationship Diagram [ERD]

  6. Entity Relationship Modeling • Entity-Relationship Diagram (ERD): Identifies information required by the business by displaying the relevant entities and the relationships between them.

  7. Entity Relationship Modeling, (Cont.) • In building a data model a number of questions must be addressed: • What entities need to be described in the model? • What characteristics or attributes of those entities need to be recorded? • Can an attribute or a set of attributes be identified that will uniquely identify one specific occurrence of an entity? • What associations or relationships exist between entities?

  8. Entity • An entity is a thing that exists and is distinguishable -- an object, something in the environment. • Examples : book, item, student • Types of entities: • Regular entity (Strong entity): if its existence does not depend on another entity. • Weak entity: if its existence depends on another entity.

  9. Attribute • An entity has a set of attributes • Attribute defines property of an entity • It is given a name • Attribute has value for each entity and value may change over time • Example : BOOK entity has the following attributes (TITLE, ISBN, AUTHOR, PUBLISHER, YEAR, PRICE) • An attribute may be multi-valued, i.e., it has more than one value for a given entity; e.g., a book may have many authors

  10. Attribute Types • Simple:Each entity has a single atomic value for the attribute ; e.g., SSN • Composite: The attribute may be composed of several components ; e.g., Name (FirstName, MiddleName, LastName) • Multi-valued:The attribute may has more than one value for a given entity; e.g., a book may have many authors • Derived attributes: The attributes whose values are generated from other attributes using calculations ; e.g., Age is derived by subtracting current date from birthdate

  11. Key Attribute • Primary Key: an attribute of an entity type for which each entity must have a unique value; e.g., SSN of EMPLOYEE. • Composite key: e.g., ID is a key of the applicant entity type with components (National_ID, Application_no) • Foreign Key (referential attributes):Attributes that define relationships between entities. The attributes of a foreign key in one entity are the attributes of a primary key in another entity; e.g., Department ID is the primary key of Department and Department ID is a foreign key of Employee defining the relationship "Employee works for Department"

  12. Relationships • Relationships: A relationship is a connection between entity classes. • The cardinalityof  a relationship indicates the number of instances in entity class E1 that can or must be associated with instances in entity class E2. • One-One Relationship:(citizen – passport , • One-Many Relationship: (student-Advisor, Customer-Order) • Many- Many Relationship: (e.g. Student-Organization, Order-Products) • Recursive Relationships: A relationship in which the same entity participates more than once.

  13. Relationships, (cont.) • Binary relationship: between two entity sets • e.g., binary relationship set STUDY between STUDENT and COURSE • Ternary relationship: among three entity sets • e.g., ternary relationship STUDY could be ternary among STUDENT, COURSE and TEACHER • A relationship may have attributes e.g., attribute GRADE and SEMESTER for STUDY

  14. Optional And Mandatory

  15. Optional And Mandatory, (cont.)

  16. ERD Notations • Rectangles represent ENTITY CLASSES • Circles represent ATTRIBUTES • Diamonds represent RELATIONSHIPS • Arcs connect entities to relationships. Arcs are also used to connect attributes to entities. Some styles of entity-relationship diagrams use arrows and double arrows to indicate the one and the many in relationships.  • Underline - Key attributes of entities are underlined.

  17. Summary Of ERD Notations

  18. Example

  19. Add Some Attributes To Entities

  20. Exercise • A company is organized into departments. Each department has a unique name, a unique number, and a particular employee who manages the department. • A department may have several locations. • A department may control a number of projects, each of which has a unique name, a unique number, and a single location. • A project must controlled by department. • We store employee’s name, social security number, address, salary, gender and birth date.

  21. Exercise, (cont.) • An employee must be assigned to one department and must work on one or more 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 want to keep track of the dependents of each employee for insurance purposes. • We keep each dependent’s first name, gender, birth date and relationship to that employee.

  22. Thank You

More Related