copyright © 2003-2008 curt hill the relational model of database basic organization and terms
TRANSCRIPT
Copyright © 2003-2008 Curt Hill
The Relational Model of Database
Basic organization and terms
Copyright © 2003-2008 Curt Hill
Relational• Form is that of a table• Each table has
– A fixed number of columns• The contents of a field in a column may be
empty
– A variable number of rows
• A row is known as a tuple• A column is a set of fields and is all of
the same type• Different tables may have different
columns
Copyright © 2003-2008 Curt Hill
Relation• In theory a relation is a set
– No ordering at all
• In practice our tuples are often ordered
• In theory a tuple is also a set• In practice a tuples are ordered
– We are able to reorder them easily
Copyright © 2003-2008 Curt Hill
Terms• Entity• Relationship• Attribute• Tuple• Table• Relation• Often many synonyms
Copyright © 2003-2008 Curt Hill
Definition: Schema• Schema - describes the rows of a table
– A set of attribute names• The definition of kinds of attributes
making up a tuple
– The definition of the file type– This is usually static, that is the file
definition does not change over time much
• Subschema– A piece of a larger schema
Schema Flavors• Conceptual Schema
– AKA logical schema– Describes data in terms of tables
• Physical Schema– How the data is actually stored– Viewpoint is the disk or hardware
• External Schema– A subset or different view of the
conceptual schema– Different users may see different
external schemaCopyright © 2003-2008 Curt Hill
Copyright © 2003-2008 Curt Hill
Definition: Body• The actual tuples making up a
relation at any one time• This usually varies over time• The contents of the file can
change often and substantially
Copyright © 2003-2008 Curt Hill
Terms Defined• Degree
– Count of attributes
• Cardinality of a relation– Number of tuples present
Copyright © 2003-2008 Curt Hill
Keys• Candidate
– Minimal collection of one or more fields that unique identify tuple
• Primary– One of the candidate keys– Who decides?
•Business expert not db expert
• Foreign– Referenced primary in another
table
Copyright © 2003-2008 Curt Hill
Other keys• Alternate
– A candidate key that is not the primary
• Secondary– (Not really a relational term)– Any set of attributes
• Does not have to be unique• Does not have to be a candidate key,
though candidate keys used in indices are often called secondary
– Used as a key in an index structure