Please enable JavaScript.
Coggle requires JavaScript to display documents.
ReDtModel, DDL, DDL, App program - Coggle Diagram
ReDtModel
principles
update operations, violations of integrity constaints, transaction
relation algebra operations: specify retrievals chapter 8
relation algebra expression: new relation
query
relational calculus
insert
IC: key, entity, domain, referential
reject; reason
reject; correct(rare)
delete
IC: referential
restrict
cascade: delete all referencing tuples together
set null, set default of the referencing attri values
combo
update
not PK or FK
PK: 等同del +insert
FK: referential IC
transaction:执行程序,包含operations(atomic unit of work)
OLTP systems 处理transactions 高速
rModel constraints
schema-based const or explicit constr
key constraints
all tuples in a relation(a set of tuples: set consists of dintinct elements) must be distinct
superkey(SK):
定义:subsets of attributes of R and no 2 tuples in any r of R should have the same combo of values for these attr
at least one for every relation: all atrributes
can have redundant attr
key(k)
性质1. It is a SK: two distinct tuples in any state of the relation 没有相同的属性组合值
性质2. It is a result of any SK removing a set of attributes that is not a SK of R: a minimal SK, we can no longer remove any attris without violating uniqueness constraints
determined from the meaning of the attribute(s); time-invariant
can >1, called candidate keys
primary key
identify tuples in r; underlined in the table;
unique key
domain constraints
atomic attr value within each tuple
examples: integerts, real numbers; Characters, Booleans, fixed-length strings, variable-length strings, date, time, timestamp; subrange of values from above time, an enumerated data type(all possible vals are explicitly listed).
constraints on NULLs
定义: specify whether NULL values are or ar not permited
entity integrity constr
定义:no primary key value can be NULL
referential integrity const
informal定义:a tuple in one relation that refers to another relation must refer to an existing tuple in that relation
formal定义:FK in R1 is said to reference R2 if:1. FK have the same domains as PK in R2, say FK references R2; 2. t1(FK) = t2(PK)/NULL, if not NULL, we say, tuple t1 references tuple t2.
FK概念: FK 需要和“引用”同时出现,需要满足2个条件
图形表示:FK到PK的带箭头折线
application-based or semantic const or business rules
meaning and behavior of attributes
work hours limit; salary limit...
inherent model-based constaints or implicity const
no duplicate tuples
data dependencies: to test design, used in normalization
functional denpendencies
multivalued dependencies
concepts and notions
files
row/tuple
column/attribute: role or interpretation of the values in the column
domain: dom(Ai)
atomic
data type w/o data format
domain names: more readable, similar in meaning to attribute
关系中定义域不同于数学中的定义域(数域),比如,usa_phone_numer(所有十位有效数字集), 是常用定义域(已经得到共识的)。很多属性可以使用这个定义域,比如,家庭电话,办公室电话,移动电话。
interpretation of name
units
relation schema: R(A1, A2, ... An)。也叫relation intension
attributes(A1,A2..An): name of roles played by some domain D
realtion/relation state(r/r(R): r = (t1,t2,..tm)。也叫relation extension。
n-tuples(t):order list of n values, t=<v1,v2,..vn>。tuple 可以说是从R到D上的mapping, 那么tuple = a set of (attribute, value) pairs, value 顺序就无所谓了。这种字典描述法:叫self-describing data
value(vi, i=1~n): an ele of dom(Ai) or NULL. 记为t[Ai], t.Ai, t[i]
atomic, not divisible, composite/multivalued attributes not allowed
This model is called flat rModel(first normal form assumption)
Null meaning
attributes does not apply
value exists but not avaliable
value unknow: know nothing about it.
决定了算术或者比较的时候如何处理
better avoid NULL
interprete: a fact or a instance of the assertion
facts of a entity
facts of a relationship
用集合论概念定义: 在dom(A1),dom(A2)..dom(An)的n度数学关系,r(R)“属于(dom(A1)
dom(A2)
..*dom(An))
特征
no ordering of tuples, simply a sett of tuples; but file and table have orders;
has ordering of values, or attributes within a n-tuple; not really if you can maintain correspondence btw attrites and vales
degree/arity(n): #of attributes
interpretation: a declaration or a type of assertion
interpretion: a predicate,断言,是一个表达式,返回真假/unknown值
性质
a set of attributes 组成key
rDB schema(S)
定义:A set of relation schema{R1,R2, .. Rm} and a set of integrity constraints(IC)
rDB state(DB) of S
定义:: a set of relation states {r1, r2,...rn} such that ri 是Ri的一个state and ri满足IC.
valid state: 满足IC中所有contrains
invalid state
Ted Codd, IBM, 1970, mathematical relation
commerical reDBMSs: DB2(ibm), Oracle(Oracle), Sybase(SAP), SQLServer, Microsoft Acess
open source systems: MySQL, PostgreSQL
RdDBConstaints
DDL
DDL
App program