Presentation is loading. Please wait.

Presentation is loading. Please wait.

Switch off your Mobiles Phones or Change Profile to Silent Mode

Similar presentations


Presentation on theme: "Switch off your Mobiles Phones or Change Profile to Silent Mode"— Presentation transcript:

1 Switch off your Mobiles Phones or Change Profile to Silent Mode
* 07/16/96 Switch off your Mobiles Phones or Change Profile to Silent Mode *

2 Relational Model

3 Topics Database Models Keys Relational Integrity Business Rule
Hierarchical Model Network Model Relational Model Entity Relationship Model Object Oriented Model Keys Primary Keys Foreign Keys Relational Integrity Business Rule

4 Database Models A way of thinking about data in a database is called a logical database model (or implementation model). Types of Logical Model Hierarchical Model Network Model Relational Model Entity Relationship Model Object Oriented Model

5 Database Models

6 Hierarchical Model Developed in the 1960s
To manage large amounts of data for complex manufacturing projects such as Apollo rocket that landed on moon (1969) Its basic logical structure is represented by an upside-down tree. The hierarchical structure contains levels, or segments. A segment is equivalent of a file system’s record type.

7 Hierarchical Model Within the hierarchy, a higher layer is perceived as the parent of the segment directly beneath it, which is called the child. The hierarchical model depicts a set of one-to-many (1:M) relationships between a parent and its children segments. Each parent can have many children, but each child has only one parent.

8 Hierarchical Model

9 Hierarchical Model

10 Hierarchical Model Hierarchical views can differ between user group

11 Network Model Network Model was created to represent complex data relationships more effectively than hierarchical model, to improve database performance, and to impose a database standard. User perceives the network database as a collection of records in 1:M relationships. Unlike the Hierarchical Model, Network Model allows a record to have more than one parent.

12 Network Model Some important concepts are:
Schema, which is the conceptual organization of entire database as viewed by database administrator. Subschema, which defines portion of database “seen” by application programs that actually produce desired information from data contained within the database.

13 Network Model Data Manipulation Language (DML), which defines environment in which data can be managed and to work with data in database. A schema Data Definition Language (DDL), which enables the database administrator to define the schema components.

14 Network Model

15 Network Model

16 Relational Model Relational Model was introduced in 1970 by E. F. Codd (of IBM) in his landmark paper “A Relational Model of Data for Large Shared Databanks” Data model that represents data in form of tables or relation.

17 Relational Model Relational database model consists of following three components: Data structure: Data are organized in form of tables or relations. Data manipulation: Powerful operations such as SQL languages or Query-by-example, are used to manipulate data stored in database. Data integrity: Business rules are specified to maintain integrity of data when they are manipulated.

18 Relational Model Physical Properties
A relation consists of 1 or more columns and 0 or more rows. A row is called a tuple. Each relation is given a unique name. Each column has a name unique within the relation. Each row contains an instance of the data associated with the relation. A relation with no rows is empty (contains no data), but still exists.

19 Relational Model Logical Properties
Columns are unordered, left to right. This property is designed to preserve the independence of each column. Rows are unordered, top to bottom. This is designed to preserve the independence of each row. No row may be duplicated in a given relation. Uniqueness in a relation is guaranteed by the designation of a Primary Key for each relation.

20 Relational Model A Candidate Key is an attribute that uniquely identifies a row in that relation. A Primary Key is a candidate key that has been selected to be unique identifier for each row. Primary key values cannot be null, since they would then not identify a row. Columns can be interchanged without changing the meaning or use of relation. It makes no difference as whether to insert a new row in front or at end of table.

21 Relational Model

22 Entity Relationship Model
Peter Chen first introduced the ER data model in 1976 Graphical representation of entities and their relationships in database structure. ER Models are normally represented in an Entity Relationship Diagram (ERD) to model database components. It complemented Relational Data model. Relational Data Model and ERM combined to provide foundation for structured database design.

23 Entity Relationship Model

24 Object Oriented Model Object-Oriented Data Model (OODM), both data and their relationships are contained in a single structure known as an object OODM reflects a very different way to define and use entities. Object is described by its factual content. Object includes information about relationships between the facts within the object, as well as information about its relationships with other objects.

25 Object Oriented Model Facts within object are given greater meaning.
OODM is said to be a Semantic Data Model because semantic indicates meaning. OODM is the basis for Object-Oriented Database Management System (OODBMS).

26 Object Oriented Model

27 Database Models Earlier Models Relational Model
Difficult to change structure Unplanned queries difficult to support Have to ‘navigate’ through the database Data stored in linked sets physically Programmer must be aware of structure Relational Model Easy to understand concepts Logical/Physical aspects clearly separated No (visible) physical pointers used Easy to set-up and change Set-oriented (not record-oriented)

28 Keys Choice of Primary Key is an important design issue
Eg. An attribute list for a PERSON entity Surname Firstname DOB Gender Passport number Driving Licence number Election number Citizenship number

29 Primary Keys PRIMARY KEY for a table T1 is a column PK of T1 such that, at any given time, no two rows of T1 have same value for PK. An entity’s primary key is one or more of its attributes which together uniquely identify an occurrence of the entity.

30 Primary Keys STUDENT (Student-ID, Student-Name, Address) STUDENT
Tom 12a Clover Street S1002 Alex Flat B High Street S1003 Brown 218 Tulip Road

31 Primary Keys FEATURES Can never take on a particular set of values in more than one occurrence of the entity. No primary key attribute can have a null value. Every attribute in the primary key is mandatory.

32 Foreign Key FOREIGN KEY is a column FK of some table T2 such that, at any given time, every (non NULL) value of FK in T2 is required to be equal to the value of the PRIMARY KEY PK in some row of some base table T1. Foreign keys are the ‘glue’ that holds the database together and rrepresents certain relationships between tuples. CUSTOMER ORDER-LINE ORDER places comprised of

33 Foreign Key LECTURER-LOCATION(Department*, Location
LECTURER(Lecture-Id, Lecture-Name, Department, Salary) Lecturer-id Lecturer-name Department Salary W01 Emma Greg Computing 35,000 S01 Wendy Holder 42,000 D01 Amy King Accounting 27,000 J02 Bob Jones 29,000 N01 Bob Whales 36,500 J01 Jack Nelson History 41,500 Department Location Computing Moorgate Accounting Staples History Lewiston LECTURER-LOCATION(Department*, Location

34 Foreign Key CUSTOMER ORDER ORDER-LINE Cust-id Cust-name Credit-Status
Business-type 1001 Smith Excellent Retail 1910 Jones Good Wholesale 2450 Brown Fair Multiple ORDER Order-no Date Cust-id* 100 01/02/06 1910 101 04/06/06 1001 102 15/06/06 ORDER-LINE Order-no* Item-no Item-name Quality 100 11 Spade 15 92 Shovel 10 101 12 102 50

35 Foreign Key Feature: Feature:
There is no requirement that a Foreign Key be a component of the Primary Key. DEPARTMENT Dept-code …… EMPLOYEE Empl-no …… Dept-code* Feature: A foreign key will be composite if the primary key it matches is composite. VEHICLE Manufacturer-name Model-name …… VEHICLE-IN-STOCK Vehicle-no Manufacturer-name* Model-name*

36 Foreign Key Feature: Many-To-Many relationships are always decomposed with Foreign keys making up a composite Primary Key. SUPPLIER Supp-no …… PART Part-no …… SUPPLY Supp-no* Part-no* ……

37 Foreign Key Feature: Note that T1 and T2 do not have to be distinct
EMPLOYEE Empl-no …… Mgr-no*

38 Foreign Key Feature: There is no requirement that a given Primary Key value must appear in a corresponding Foreign Key. CUSTOMER Cust-id Cust-name Credit-Status Business-type 1001 Smith Excellent Retail 1910 Jones Good Wholesale 2450 Brown Fair Multiple ORDER Order-no Date Cust-id* 100 01/02/06 1910 101 04/06/06 1001 102 15/06/06

39 Domains The range of values that the entries in a particular column can take is known as the domain. Example: The domain of gender has only two values (e.g. Male/Female). The domain of start date could be any valid date greater than 01/01/2006. The domain of salary may be restricted to the range 20, ,000.

40 Relational Integrity Integrity in a database is concerned with the database having correct and consistent data. Domain Integrity Rule Every attribute is required to satisfy the constraint that its values are drawn from the relevant domain. Entity Integrity Rule No component of the primary key of a base relation is allowed to accept nulls.

41 Relational Integrity Referential Integrity Rule
The database must not contain any unmatched foreign key values. User-Defined or Application-Specific Integrity

42 Referential Integrity
If a foreign key exists in a relation, either foreign key value must match a candidate key value of some tuple in its home relation or foreign key value must be wholly null. CUSTOMER ORDER places

43 Referential Integrity
CUSTOMER(Cust-id, Cust-name, Credit-status, Business-type Cust-id Cust-name Credit-Status Business-type 1001 Smith Excellent Retail 1910 Jones Good Wholesale 2450 Brown Fair Multiple ORDER(Order-no, Date, Cust-id*) Order-no Date Cust-id* 100 01/02/06 1910 101 04/06/06 1001 102 15/06/06

44 Referential Integrity
For Deletion and Update RESTRICTED Operation is ‘restricted’ to the case where no such matching occurs. i.e. attempt to delete (update) customer id 1001 fails. CASCADES Operation cascades to delete matches as well. i.e. delete (update) customer id 1001 and orders 101.

45 Referential Integrity
For Deletion and Update NULLIFIES Foreign key is set to null in all matches and record is deleted (updated). i.e. delete (update) record, set cust-id in orders 101 to null.

46 Business Rules Brief, precise, and unambiguous description of a policy, procedure, or principle within a specific organization’s environment Apply to any organization that stores and uses data to generate information Description of operations that help to create and enforce actions within that organization’s environment

47 Business Rules Must be rendered in writing Must be kept up to date
Sometimes are external to organization Must be easy to understand and widely disseminated Describe characteristics of the data as viewed by company

48 Sources of Business Rules
Company Managers Policy Makers Department Managers Written Documentation Procedures Standards Operations manuals Direct interviews with end users

49 Importance of Business Rules
Promote creation of accurate data model Standardize company’s view of data Constitute a communications tool between users and designers Allow designer to understand nature, role, and scope of data Allow designer to understand business processes Allow designer to develop appropriate relationship participation rules and constraints

50 Any Questions?


Download ppt "Switch off your Mobiles Phones or Change Profile to Silent Mode"

Similar presentations


Ads by Google