Date post: | 12-Nov-2014 |
Category: |
Education |
Upload: | bala-ganesh |
View: | 74 times |
Download: | 10 times |
Subject Name Code Credit HoursDatabase System COMP 219 3
Chapter VII
Subject Name Code Credit HoursDatabase System COMP 219 3
Relational Model:• It uses a collection of tables to represent
both data and relationships among those data.
Basic StructureIn this model each table is called as
relation. Each relation has a no. of row is called tuples and columns called as fields or attributes.
Subject Name Code Credit HoursDatabase System COMP 219 3
Relational Model:
• For an attribute, a range of permitted values can be specified. That range is called as Domain of that attribute.
• E.g.. Age – attribute• Domain (Age) = {1,2…100}
Subject Name Code Credit HoursDatabase System COMP 219 3
Relational Model:
• A table of n attributes must be a subset of D1*D2*…….Dn• E.g..
Eid Ename Eaddr1
2
3
Aaa
Bbb
ccc
South street
West street
New
Employee Relation
Subject Name Code Credit HoursDatabase System COMP 219 3
Relational Model:
• To denote the value of attribute ‘a’ on second tuple, then it can be denoted as t2[a]=value.
• E.g..• t2[ename]=“bbb”.
Subject Name Code Credit HoursDatabase System COMP 219 3
Relation schema
• It is the description about the structure of the relation and the relation instance is the snapshot of data in the relation at a given instant in time.
• E.g.. Employee_schema=(eid,ename,eaddr)
Name of the schema
Subject Name Code Credit HoursDatabase System COMP 219 3
Relation schema
• Empoyee(Employee_schema) denote that • Employee is a relation on Employee_schema
Subject Name Code Credit HoursDatabase System COMP 219 3
Keys
• Strong Entity set:• The Primary key of the entity set becomes the primary
key of the relation.
• Weak Entity Set:• The table corresponding a weak entity set includes• the attributes of the weak entity set &• primary key of the strong entity set on which the weak
entity set depends.
Subject Name Code Credit HoursDatabase System COMP 219 3
Keys
Relationship Set: The union of the primary key of the related entity sets
becomes a super key of the relation.Combined Tables: If there exists many to one relationship set from A to B,
then the prim.key of A becomes the prim.key of the relation & the relation consists of the attribues of A and attributes of the relationship set.
Subject Name Code Credit HoursDatabase System COMP 219 3
Keys
Foreign Key: An attribute of a relation r1 that references
relation r2 is called as foreign key attribute.Schema Diagram:
A relation schema can be depicted pictorially by schema diagram,
Subject Name Code Credit HoursDatabase System COMP 219 3
Keys
• E.g..eid Ename eaddr dno
dnamedno dloc
Employee
pnamepno eid
Dept
Project
Subject Name Code Credit HoursDatabase System COMP 219 3
Query Languages:
• It is a lang in which a user requests information from db.Query Languages
Procedural Language Non Procedural Language
Specifies what data are required & specify how to get those data e.g Relational Algebra
Specifies what data are required without specify how to get those data e.g. Relational calculus