E-R Model , abstract , independent of database implementation
Requirement -> E-R Model -> Database Implementation
Mapping the meaning of interations of real-world enterprises onto a conceptual schema
Mapping the real-world information and their relationship into E-R Model
Entity : An entity has attributes (a record)
attribute type : simple and single value
composite(eg. an attribute composed by family_name + last_name)
multivalued(eg. an phone attribute for on person, phone1, phone2)
Derived(to be calculated from other attribute)
Entity Set : A set of entityes have the same type (a table)
A relationship is an association among several entities.
{ (e1, e2, e3) | e1∈E1, e2∈E2, e3∈E3 }, (e1, e2, e3) is a relationship
A super-key is a set of one or more attributes that, taken collectively, allow us to identify an entity in the entity set.
A candidate-key is the minmal super-key, there may be many.
Aggregation In ER-Model : treat the relationship of several entities as a new entity, and connect it with another entity, That's the resuse of relationship.
tuple = entity = record
Storage and File Structure
The unit of disk operation is a block, about 512 Bytes
* Fixed-Length Records
When delete an record : mark blank by free link list method , Or, move the bottom record to take the room
* Variable-Length Records
A block contains many records
| p1 p2 p3 .................free room .........e3, e2, e2 | the pointer in the front points to the real entity, when an entity is deleted, the entites at the behine in the same block is moved up.
Database Index
Primary Index : If any, only one. The record in the disk should be stored sequentially according to the index key.
Secondary Index : Can be multiple, independent with the record alignment in the disk. It's the index in normal sense.
Tree
B Tree :
B- Tree :
B+ Tree :
B* Tree :
Hash
Static Hash : Normal hash, hash the key to the bucket(disk block)
Dynamic Hash : The size of the hash table can be changed, when chang happen, all the data in bucket has to be reorganized to adapt the hash table of new size.
Bitmap
The value of a field is limited to several choices, it's used to facilitate the composition query.