Many to Many
Everything allowed
Many to one
Only one end at arrow side
None is okay
One to one
Exaclt one,
none is not an option
Adding a relation
CREATE TABLE [Name] (
[row name] [data type] <Constraint>,
[another row name] [data type] <Constraint>,
<PRIMARY KEY (some row name, some other row name)>
);
Row constraints
NOT NULL
DEFAULT value
UNIQUE
PRIMARY KEY
unique
not null
CHECK([some bool /a subquerry])
REFERENCES [Table name]([attribute name])
Datatypes
INT
CHAR([x])
Lenght must match x
VARCHAR([x])
Lenght < x
DATE
TIME
Conflict Graph
Conflict if the following on same element
R/W
W/R
W/W
Not if
R/R
Edges on conflicting transactions
Arrow from first to later statement
Sequelizable if graph acyclic
Algorithms
Log can be temporarilly in mem, but as to be on stable disk before tansaction can be comitted to mem
Operation
Log every edit (to cache)
output to disk some time later
Recovery
Undo all T without commit
Redo all comitted T
+ fast during operation
+ allows have done transactions on disk
- complex recovery
Stable log required
log everything
ouput to disk later, but only after log is on stable storage
Redo comitted T
No half messages as only comitted edits are on stable storage
+ Faster recovery
+ smaller log, no before values needed
- limits operations to mem
ouput to disk immediatly, together with commit to stable
Undo all half done T (not comitted)
All commited have to be on disk anyways
+ smaller log, no after values needed
- many many disk IO
Cheap (do first)
Restrictive Selection a like “Peter”
Other selection
Projection
Joint
Very expencive, do last
3NF
Keine Abhängigkeit der Attribute untereinander
Zuletzt geändertvor 2 Tagen