the relational model
play

The Relational Model Requirements analysis Conceptual design data - PDF document

Overview of Database Design The Relational Model Requirements analysis Conceptual design data model Logical design Schema refinement: Normalization Physical tuning


  1. Overview of Database Design The Relational Model � Requirements analysis � Conceptual design � data model � Logical design � Schema refinement: Normalization � Physical tuning �������������������������������������������� ������������������� �������������������������������������������� ������������������� Why Study the Relational Relational Database: Definitions Model? � Most widely used model. � Relational database: a set of relations � Relation: made up of 2 parts: � Vendors: IBM, Microsoft, Oracle, Sybase, etc. � “Legacy systems” in older models � Schema : specifies name of relation, plus name and type of each column. � E.G., IBM’s IMS � E.G. Students( sid : string, name : string, login : � Recent competitor: object-oriented model string, age : integer, gpa : real). � ObjectStore, Versant, Ontos � Instance : a table , with rows and columns. � A synthesis: object-relational model #Rows = cardinality , #fields = degree / arity. � Informix Universal Server, Oracle, DB2 � Can think of a relation as a set of rows or � XML tuples (i.e., all rows are distinct). �������������������������������������������� ������������������� �������������������������������������������� �������������������

  2. Logical DB Design: ER to Example Instance of Students Relational Relation ���� ����� ������ ���� ���� � Entity sets to tables. ������ ������ ������ �� !"� ��#� ���""� ������ �������� �� !"� ��$� name ����%� ������ ����������� !&� ��"� ssn lot � � '�����������(�����������(����������)�������� � Employees � ������� ��*������������������������ ����+���� ��������� �, �������������������������������������������� ������������������� �������������������������������������������� ������������������� Example Instance Integrity Constraints (ICs) � IC: condition that must be true for any instance of the database Employees � Domain constraints ssn name lot � Key constraints 0983763423 John 10 � Foreign key constraints (later) 9384392483 Jane 10 � A legal instance of a relation is one that 3743923483 Jill 20 satisfies all specified ICs. � DBMS should not allow illegal instances � Avoids data entry errors too! �������������������������������������������� ������������������� �������������������������������������������� �������������������

  3. Primary Key Constraints What does this mean? � A set of fields is a superkey for a relation if : 1. No two distinct tuples can have same values in all fields '�-./-�/.01- -������� � A set of fields is a key if: 2��� '3.� 2$%4 ���� '3.�2$%4 � 1. The set of fields is a superkey ������ '3.� 2$4� 2. No proper subset of the set of fields is a superkey 5�6�.�7�8-7�� 2���� ��4�4 � If there’s >1 key for a relation, one of the keys is chosen (by DBA) to be the primary key . � E.g., ssn is a key for Employees. (What about name ?) The set { ssn, name } is a superkey. �������������������������������������������� ������������������� �������������������������������������������� ������������������� Candidate Keys Where do ICs Come From? � Possibly many candidate keys (specified � ICs are based upon the semantics of the real- using UNIQUE ), one of which is chosen as the world enterprise that is being described in the database relations. primary key . '�-./-�/.01- -������� � We can check a database instance to see if an IC 2��� '3.� 2$%4 is violated, but we can NEVER infer that an IC is ���� '3.�2$%4 � ������ '3.� 2$4� true by looking at an instance. 5�6�.�7�8-7�� 2���4� � An IC is a statement about all possible instances! :96;:- 2 ���������4�4 � From example, we know name is not a key, but the assertion that sid is a key is given to us. � -� ����*�������������������������������� �*��� � Key and foreign key ICs are the most common; � 9���)����*����������� �*���������������������� more general ICs supported too. �������������������������������������������� ������������������� �������������������������������������������� �������������������

  4. Relationship Sets to Tables ER to Relational (contd.) since name dname ssn lot did budget Works_In Employees Departments �������������������������������������������� ������������������� �������������������������������������������� ������������������� Foreign Keys, Referential Example Instance Integrity Employees Departments � Foreign key : Set of fields in one relation did dname budget ssn name lot that is used to `refer’ to a tuple in another 0983763423 John 10 101 Sales 10K relation 9384392483 Jane 10 105 Purchasing 20K � Must correspond to primary key of the second 3743923483 Jill 20 108 Databases 1000K relation � Like a `logical pointer’. Works_In � If all foreign key constraints enforced, ssn did since 0983763423 101 1 Jan 2003 referential integrity is achieved, i.e., no 0983763423 108 2 Jan 2003 dangling references. 9384392483 108 1 Jun 2002 � Not like HTML links! �������������������������������������������� ������������������� �������������������������������������������� �������������������

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend