CS-GY 6083: Principles of Database Systems
main
main
  • Introduction
  • DBMS Basics
    • Introduction to DBMS
    • Why use a DBMS instead of a File System?
    • Levels of Abstraction
    • Instances and Schemas
  • Data Models
    • Introduction to Data Models
    • Database Languages
    • Database Design
  • DBMS Internals
    • Introduction to DBMS Internals
    • Storage Manager
    • Query Processor
    • Transaction Management
    • Database Users
    • Database Architecture
  • DBMS History
  • Some Popular Database Systems
  • OLTP, OLAP, and Data Mining
  • Databases vs. Information Retrieval
  • The Entity-Relationship Model - Details
    • Introduction
    • Cardinality Constraints
    • ER Diagram Components
    • ER Diagram to Relational Schema
    • Design Issues
  • The Relational Model - Details
    • Relations
    • Keys
    • Relational Query Languages
      • Relational Algebra
      • Relational Calculus
      • Relative Expressive Power
    • Relational Operators
  • SQL
    • Introduction to SQL
    • Domain Types in SQL
    • DDL Commands
      • Creating a Table
      • Alter and Drop
    • DML Commands
      • Basic Query Structure
      • Select
      • From
      • Where
      • Joins
      • Rename
      • String Operations
      • Ordering
      • Set Operations
      • Group By and Having
      • Nested Subqueries
      • Test for Empty Relations
      • Test for Duplicate Tuples
      • Derived Relations
      • With
      • Database Modification
    • Intermediate SQL
      • Joins Revisited
      • Views
      • Transactions
      • Integrity Constraints
      • More SQL Data Types and Schemas
        • Other Features
      • Authorization
    • Advanced SQL
      • Accessing SQL From a Programming Language
        • ODBC and JDBC
        • Embedded SQL
        • PHP
        • Some Security Issues
      • Accessing Metadata
      • Text Operations
        • Like
        • Contains
      • Cursors
      • Functions and Procedures
        • Procedural Constructs
        • External Language Routines
      • Triggers
      • Ranking
      • Windowing
      • OLAP
Powered by GitBook
On this page

Was this helpful?

  1. The Entity-Relationship Model - Details

ER Diagram to Relational Schema

PreviousER Diagram ComponentsNextDesign Issues

Last updated 4 years ago

Was this helpful?

A database whose entities and relations have been modeled as an ER diagram can be represented as a set of relational schemas, one for each entity and relation.

  • A strong entity set reduces to a schema with the same attributes

  • A weak entity set becomes a table that includes a column for the primary key of the identifying strong entity set Ex. In the following diagram, section is the weak entity and course is the strong/identifying entity.

  • A many-to-many relationship set is represented as a schema with attributes for the primary keys of the two participating entity sets, and any descriptive attributes of the relationship set. Ex.

  • Many-to-one and one-to-many relationship sets that are total on the many-side can be represented by adding an extra attribute to the “many” side, containing the primary key of the “one” side (instead of creating a new schema for the relation) Ex.Instead of creating a schema for relationship set inst_dept, add an attribute dept_name to the schema for the entity set instructor.

  • For one-to-one relationship sets, either side can be chosen to act as the “many” side, i.e. the extra attribute can be added to either of the tables corresponding to the two entity sets

  • Composite attributes are flattened out by creating a separate attribute for each component attribute

  • A multivalued attribute M of an entity E is represented by a separate schema EM

    • Schema EM has attributes corresponding to the primary key of E and an attribute corresponding to multivalued attribute M

    • Ex. Multivalued attribute phone_number of instructor is represented by a schema:

      inst_phone= ( ID, phone_number)

    • Each value of the multivalued attribute maps to a separate tuple of the relation on schema EM. For example, an instructor entity with primary key 22222 and phone numbers 456-7890 and 123-4567 maps to two tuples: (22222, 456-7890) and (22222, 123-4567)

  • Representing specializations as schemas:

    • Method 1: form a schema for the higher-level entity, form a schema for each lower-level entity set, then include primary key of higher-level entity set and local attributes. The drawback is that we would have to access two relations to get the required information

    • Method 2: form a schema for each entity set with all local and inherited attributes. The drawback is redundancy