Relational Database Management System the Relational Model

Relational Database Management System the Relational Model

www.getmyuni.com Lecture 7 Relational Database Management System www.getmyuni.com The Relational Model • Due to Codd. • Everything is represented as a relation. • A database therefore is a collection of tables, each of which has a unique name, and each of which is described by a schema. • In addition, Codd defined a data manipulation language. www.getmyuni.comExample of Schemas in the Relational Model • Example of a representation of entity sets: Student(sid,name,addr) Course(cid,title,eid) Empl(eid, ename, deptid) Dept(deptid, dname, loc) • Primary keys are underlined. • Recall that a primary key is one that uniquely identifies an entity. • An entity is a row in a table. www.getmyuni.com Relational Databases: Basic Concepts I • Attribute: – A column in a table • Domain – The set of values from which the values of an attribute are drawn. • Null value – A special value, meaning “not known” or “not applicable”. • Relation schema – A set of attribute names www.getmyuni.comRelational Databases: Basic Concepts II • Tuple – A set of values, one for each attribute in the relation scheme over which the tuple is defined, i.e. a mapping from attributes to the appropriate domains • Relation instance – A set of tuples over the scheme of the relation www.getmyuni.com Relational Databases: Basic Concepts III • Relational Database – A set of relations, each with a unique name • Normalized Relation – A relation in which every value is atomic (non-decomposable). Hence, every attribute in every tuple has a single value. www.getmyuni.com Keys • Candidate Key – A minimal set of attributes that uniquely identifies a tuple • Primary Key – The candidate key chosen as the identifying key of the relation • Alternate Key – Candidate keys which are not primary keys www.getmyuni.com • Foreign Key – An attribute (or set of attributes) in table R1 which also occurs as the primary key of relation R2. – R2 is called the referenced relation. – Foreign keys are also called connection keys or reference attributes. www.getmyuni.com Integrity Rules: Entity Constraint • Entity constraint – All attributes in a primary key must be non- null. – Motivation: If the primary key uniquely identifies an entity in an entity set, then we must ensure that we have all the relevant information www.getmyuni.com Integrity Rules: Referential Integrity • Referential integrity – A database cannot contain a tuple with a value for a foreign key that does not match a primary key value in the referenced relation. – Or, a foreign key must refer to a tuple that exists. – Motivation: If referential integrity were violated, we could have relationships between entities that we do not have any information about. www.getmyuni.com Codd Rules • Rules for a Database to qualify as Relational Database 1. Information Rule 2. Guaranteed Access Rule 3. Comprehensive Data Sub-language Rule 4. View Update Rule 5. High Level Insert, Update and Delete 6. Physical Data Independence 7. Logical Data Independence 8. Integrity Independence 9. Non Subversion Rule 10.Systematic Treatment of Null Values 11.Database Description Rule 12.Distribution Independence www.getmyuni.com Data Manipulation Languages • In order for a database to be useful, it should be possible to store and retrieve information from it. This is the role of the data manipulation language. • One of the attractions of the relational data model is that it comes with a well-defined data manipulation language. www.getmyuni.com Types of DML • Two types of data manipulation languages – Navigational (procedural) • The query specifies (to some extent) the strategy used to find the desired result e.g. relational algebra. – Non-navigational(non-procedural) • The query only specifies what data is wanted, not how to find it e.g. relational calculus..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us