Relational Model.pdf

# Relational Model.pdf

• 53

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

RELATIONAL MODEL Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational Calculus Extended Relational-Algebra- Operations Modification of the Database Views Copyright @

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

EXAMPLE OF A RELATION Copyright @
BASIC STRUCTURE 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 each a i D i Example: if customer-name = {Jones, Smith, Curry, Lindsay} customer-street = {Main, North, Park} customer-city = {Harrison, Rye, Pittsfield} Then r = { (Jones, Main, Harrison), (Smith, North, Rye), (Curry, North, Rye), (Lindsay, Park, Pittsfield)} is a relation over customer-name x customer-street x customer-city Copyright @

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

ATTRIBUTE TYPES 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 definition of many operations we shall ignore the effect of null values in our main presentation and consider their effect later Copyright @
RELATION SCHEMA 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) Copyright @

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

RELATION INSTANCE The current values ( relation instance ) of a relation are specified 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 Pittsfield customer-city customer attributes (or columns) tuples (or rows) Copyright @
RELATIONS ARE UNORDERED Order of tuples is irrelevant (tuples may be stored in an arbitrary order) E.g. account relation with unordered tuples Copyright @

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

DATABASE 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 deals with how to design relational schemas Copyright @

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

This is the end of the preview. Sign up to access the rest of the document.
• Fall '16
• Relational model, Copyright @ www.bcanotes.com

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern