3%20-%20Relational%20model

# 3 Relational%2 - Formally given sets D 1 D 2 … D n a relation r is a subset of D 1 x D 2 x … x D n Thus a relation is a set of n-tuples a 1 a 2

This preview shows pages 1–13. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Formally, given sets D 1 , D 2 , …. D n a relation r is a subset of D 1 x D 2 x … x D n Thus a relation is a set of n-tuples ( a 1 , a 2 , …, a n ) where a i ∈ D i Example: if customer-name = {Jones, Smith, Curry, Lindsay} customer-street = {Main, North, Park} customer-city = {Harrison, Rye, Pitts¡eld} Then r = { (Jones, Main, Harrison), (Smith, North, Rye), (Curry, North, Rye), (Lindsay, Park, Pitts¡eld)} is a relation over customer-name x customer-street x customer-city Each attribute of a relation has a name The set of allowed values for each attribute is called the domain of the attribute Attribute values are (normally) required to be atomic , that is, indivisible E.g. multivalued attribute values are not atomic E.g. composite attribute values are not atomic The special value null is a member of every domain The null value causes complications in the deFnition of many operations we shall ignore the effect of null values in our main presentation and consider their effect later A 1 , A 2 , …, A n are attributes R = ( A 1 , A 2 , …, A n ) is a relation schema E.g. Customer-schema = ( customer-name, customer-street, customer-city ) r ( R ) is a relation on the relation schema R E.g. customer (Customer-schema) The current values ( relation instance ) of a relation are speciFed by a table An element t of r is a tuple , represented by a row in a table Jones Smith Curry Lindsay customer-name Main North North Park customer-street Harrison Rye Rye PittsFeld customer-city customer attributes tuples Order of tuples is irrelevant (tuples may be stored in an arbitrary order) E.g. account relation with unordered tuples A database consists of multiple relations Information about an enterprise is broken up into parts, with each relation storing one part of the information E.g.: account : stores information about accounts depositor : stores information about which customer owns which account customer : stores information about customers Storing all information as a single relation such as bank ( account-number, balance, customer-name , ..) results in repetition of information (e.g. two customers own an account) the need for null values (e.g. represent a customer without an account) Normalization theory (Chapter 7) deals with how to design relational schemas Let K ⊆ R K is a superkey of R if values for K are sufFcient to identify a unique tuple of each possible relation r(R) by “possible r ” we mean a relation r that could exist in the enterprise we are modeling. Example: { customer-name, customer-street } and { customer-name } are both superkeys of Customer , if no two customers can possibly have the same name....
View Full Document

## This note was uploaded on 01/24/2011 for the course CS 585 at USC.

### Page1 / 74

3 Relational%2 - Formally given sets D 1 D 2 … D n a relation r is a subset of D 1 x D 2 x … x D n Thus a relation is a set of n-tuples a 1 a 2

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online