首先,再次強調這是一個雙語教程,所以學起來就會比較困難(正常操作,所以對自己有點信息吧小同學
正文開始,先複習一下上節課的內容)
Review
- DB : Database
- DBMS : Database Management System
- DBS : Database System
- Database System / file system (advantages / drawbacks)
- Users of database system (five kinds of user)
- Data model of database (Relational / Network / Hieriarchical / …)
- View of Data(three levels includes View / Logical / Physical)
- Database Language
- Transaction Management
- Query processing
- History of database & challenges
Relational Model
the relational model was abstracted from table and processing methods of table .
SQL was proposed and developed based on relational model . It is the foundation of many database theories .
==>A relation is a table .
Domain (域) the range of values of Column / Attribute
the number of elements in the set is called Cardinality (基數) .
Cartesian product (笛卡爾積)
Formally , given sets of domain D1 , D2 , … , Dn , and the cartesian product is represented as :
D1 X D2 X … X Dn = { ( d1 , d2 , … , dn ) | di ∈ Di, i = 1,2,…,n}
The element of cartesian product , ( d1 , d2 , … , dn ) is called n-tuple (n元組) .
Each di in the tuple ( d1 , d2 , … , dn ) is called a component (分量) .
If the cardinality of Di is mi , then the cardinality if cartesian product .
i.e. the number of tuples is : m1 X m2 X … X mn
Formally , a relation r is a set of n-tuple ( d1 , d2 , … , dn ) where each di ∈ Di .
Not all tuples are meaningful .
Column Name / Attribute Name
Relation is denoted as R(A1:D1 , A2:D2 , … , An:Dn) , or briefly denoted as R(A1 , A2 , … , An) and we also call this kind of relation as Relation Schema .
R is the name of relation , Ai is the attribute , Di is the domain of attribute , n is the degree of relation ,the number of tuple in relation is called Cardinality of Relation .
Relation (Relation Instance 實例) and Relation Schema
One relation schema → many different relations (relation instances) .
Relation schema is the structure of relation , and relation (relation instances) is a snasphot of the data relation schema at a given instant in time .
關係的五個特性(ppt放太快沒記下來英文就很尷尬)
- Homogeneity (同質) of the column / attribute
Each component of one column comes from the same domain , and has a same data type . - The order in which columns appear in a relation is irrelevant (無關,不相關) .
- The order in which tuples appear in a relation is irrelevant .
- Each tuple / row should be different from other , i.e. no two tuples in a relaction are allowed to have exactly the same value for all attributes .
- Attribute is atomic , and could not be divided anymore , and this character is also called NF .
Key : Candidate key [候選碼 / 候選鍵]
Candidate key : an attribute or a group of attributes from a relation , its value or thier values can uniquely identify the tuple .
It is possible that there are more than one candidate key for a relation .
=================下次更新預告----------------------------白白白白,不定時,因爲懶-------------------
Primary key & Super key [主碼和超碼]
Single key / All key & Primary attribute / non-peimary key [單一碼/全碼 & 主屬性/非屬性碼]
Foreign key [外碼]
Integrity Constraint [完整性約束]