1 / 20

Relational Model Concepts

Relational Model Concepts. Relational Model Concepts. The relational model represents the database as a collection of relations. The relational Model of Data is based on the concept of a Relation. A Relation is a mathematical concept based on the ideas of sets.

cahil
Download Presentation

Relational Model Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Relational Model Concepts

  2. Relational Model Concepts • The relational model represents the database as a collection of relations. • The relational Model of Data is based on the concept of a Relation. • A Relation is a mathematical concept based on the ideas of sets. • The strength of the relational approach to data management comes from the formal foundation provided by the theory of relations. Database Management Systems

  3. Relational Model Concepts • The model was first proposed by Dr. E.F. Codd of IBM in 1970 in the following paper:"A Relational Model for Large Shared Data Banks," Communications of the ACM, June 1970. The above paper caused a major revolution in the field of Database management and earned Ted Codd the coveted ACM Turing Award. Database Management Systems

  4. INFORMAL DEFINITIONS • RELATION: A table of values • A relation may be thought of as a set of rows. • A relation may alternately be though of as a set of columns. • Each row represents a fact that corresponds to a real-world entity or relationship. • Each row has a value of an item or set of items that uniquely identifies that row in the table. • Sometimes row-ids or sequential numbers are assigned to identify the rows in the table. • Each column typically is called by its column name or column header or attribute name. Database Management Systems

  5. Database Management Systems

  6. FORMAL DEFINITIONS • A Relation may be defined in multiple ways. • The Schema of a Relation: R (A1, A2, .....An) Relation schema R is defined over attributes A1, A2, .....An For Example - CUSTOMER (Cust-id, Cust-name, Address, Phone#) Here, CUSTOMER is a relation defined over the four attributes Cust-id, Cust-name, Address, Phone#, each of which has a domain or a set of valid values. For example, the domain of Cust-id is 6 digit numbers. Database Management Systems

  7. FORMAL DEFINITIONS • A tuple is an ordered set of values • Each value is derived from an appropriate domain. • Each row in the CUSTOMER table may be referred to as a tuple in the table and would consist of four values. • <632895, "John Smith", "101 Main St. Atlanta, GA 30332", "(404) 894-2000">is a tuple belonging to the CUSTOMER relation. • A relation may be regarded as a set of tuples (rows). • Columns in a table are also called attributes of the relation. Database Management Systems

  8. FORMAL DEFINITIONS • A domain has a logical definition: e.g.,“USA_phone_numbers” are the set of 10 digit phone numbers valid in the U.S. • A domain may have a data-type or a format defined for it. The USA_phone_numbers may have a format: (ddd)-ddd-dddd where each d is a decimal digit. E.g., Dates have various formats such as monthname, date, year or yyyy-mm-dd, or ddmm,yyyy etc. • An attribute designates the role played by the domain. E.g., the domain Date may be used to define attributes “Invoice-date” and “Payment-date”. Database Management Systems

  9. FORMAL DEFINITIONS • The relation is formed over the cartesianproduct of the sets (The Cartesian product, also referred to as a cross-join, returns all the rows in all the tables listed in the query.  Each row in the first table is paired with all the rows in the second table.); each set has values from a domain; that domain is used in a specific role which is conveyed by the attribute name. • For example, attribute Cust-name is defined over the domain of strings of 25 characters. The role these strings play in the CUSTOMER relation is that of the name of customers. • Formally, Given R(A1, A2, .........., An) r(R) dom (A1) X dom (A2) X ....X dom(An) • R: schema of the relation • r of R: a specific "value" or population of R. • R is also called the intension of a relation • r is also called the extension of a relation

  10. FORMAL DEFINITIONS • Let S1 = {0,1} • Let S2 = {a,b,c} • Let R  S1 X S2 • Then for example: r(R) = {<0,a> , <0,b> , <1,c> } is one possible “state” or “population” or “extension” r of the relation R, defined over domains S1 and S2. It has three tuples. Database Management Systems

  11. DEFINITION SUMMARY

  12. The attributes and tuples of a relation STUDENT Database Management Systems

  13. Characteristics of Relations • Ordering of tuples in a relation • The Tuples in a relation do not have any particular order. In other words, a relation is not sensitive to the ordering of the tuples. • However while storing on a physical location on a disk, they are always among the order. • Ordering of values within a tuple and an alternative definition of a relation • 1sttheory of definition • According to first definition ordering is maintained. Ordering of tuples and attribute in relational schema is important • 2ndtheory of definition • Order of attributes and values is not that important. As long as correspondence between attributes and values are maintained

  14. Characteristics of Relations (contd.) • Alternative definition of a relation • Tuple considered as a set of (<attribute>,<value>) pairs • Each pair gives the value of the mapping from an attribute Ai to a value vi from dom(Ai) • Use the first definition of relation • But we generally prefer to use first definition where Attributes and the values within tuples are ordered • because of its Simpler notation.

  15. Two identical tuples when the order of attributes and values is not part of relation definition. Database Management Systems

  16. Characteristics of Relations (contd.) • Values and NULLs in tuples : • NULL value is an important concept which is used to represent the values of attribute that may be unknown or may not apply to a tuple. • E.g. Some student tuples NULL for their office phone because they do not have an office (i.e. office does not apply to these students). • In other case student has a NULL for home phone presumably because either he does not have a phone or he has one but we do not know it (value is unknown)

  17. Characteristics of Relations (contd.) • Flat Relational Model • Each value in a tuple is an atomic value i.e. it is not divisible into further components within the framework of relational model. Hence composite and multivalued attribute are not allowed. • Multivalued attributes • • Must be represented by separate relations • Composite attributes • • Represented only by simple component attributes in basic relational model

  18. Characteristics of Relations • Interpretation (meaning) of a relation • Assertion(A confident and forceful statement of fact or belief) • Each tuple in the relation is a fact or a particular instance of the assertion. • A student entity has a NAME, SSN, HOMEPHONE, AGE, GPA. Each tuple in the relation can than be interpreted as a fact or a particular instance of the assertion. The asserts the fact that there is a STUDENT whose NAME is Benjamin, SSN is 305-61-2435, Age is 19 and so on.

  19. Characteristics of Relations (contd.) • Predicate • The values in each tuple are interpreted as values that satisfy the predicate. • For example the predicate STUDENT (NAME, SSN, PHONE, ADDRESS, gpa…) is true for the five tuples in relation STUDENT. • These tuples represent five different preposition or facts in the real world.

  20. The relation STUDENT with a different order of tuples Database Management Systems

More Related