The Relational Model - University of Liverpoolkjc/COURSENOTES/102/06... · Relational Model •...
Transcript of The Relational Model - University of Liverpoolkjc/COURSENOTES/102/06... · Relational Model •...
The Relational Model
Readings: Elmasri&Navathe: Chapter “The Relational Data Model and Relational Database Constraints"
(Chapter 5 in the 7th and 5th edition, Chapter 3 in the 6th edition)
Relational Model
• Idea from a 1970 paper on Communications of the ACM by E.F. Codd
• application of concepts from a branch of mathematics (relational algebra) to the problem of storing large amounts of data
• vision: intuitive enough for users to create databases without assistance...
• in fact the process is not so straightforward...
• ... but maintaining a strong theoretical background (findings can be mathematically proved as theorems)
• the very notion of relation is a mathematical one (they are normally called “tables”)
• First commercial implementations available in early 1980s
Relational Model• Represents data as a set of relations
• a relation has a name (typically corresponding to a real-world entity or relationship)
• a relation is a collection of related data values
• visualised as a “table” of values
• where each “row” is a “fact”
• in relational jargon a row is called a Tuple
• column names interpret the meaning of the values in each row
• we call them attributes
Interpretation (meaning) of a relation
• as an Assertion
• Each tuple in the relation is a fact or a particular instance of the assertion
• as a Predicate
• Values in each tuple are values that satisfy a predicate
Relational Model Main Concepts
More formally• Relation schema R
• Denoted by R(A1, A2, ...,An)
• a relation name R and a list of attributes, A1, A2, ..., An
• Attribute Ai
• Name of a role played by some domain D in the relation schema R
• a Domain is a set of atomic values (indivisible) specified by a data type
• the domain of attribute Ai is indicated by dom(A
i)
• Degree (or arity) of a relation
• Number of attributes (n) of its relation schema
More formally (ctd)• Relation (or relation state) r(R)
• Set of n-tuples r = {t1, t2, ..., tm}, each n-tuple ti is
• an ordered list of n values t =<v1, v2, ..., vn>
• where each value vi, 1 ≤ i ≤ n, is an element of dom(Ai) or is a special NULL value
• Can be thought of as:
• Mathematical relation of degree n on the domains dom(A1), dom(A2), ..., dom(An)
• Subset of the Cartesian product of the domains that define R:
• r(R) ⊆ (dom(A1) × dom(A2) × ... × dom(An))
Relations: order
• A Relation is defined as a set of tuples
• Elements have no order among them (by definition of set!)
• Order of attributes and values is not important as long as correspondence between attributes and values is maintained
• Alternative definition of a relation
• Tuple considered as a set of (<attribute>, <value>) pairs
• Each pair gives the value of the mapping from an attribute Ai to a value vi from dom(Ai)
• t[Ai] or t. Ai can be used to refer to the value vi in t for attribute Ai
• we’ll use the first, simpler definition of relation
Properties of Relations
• Each value in a tuple is atomic
• Flat relational model
• Composite and multivalued attributes are not allowed
• First normal form assumption
• Multivalued attributes:
• Can be modelled but must be represented by separate relations
• Composite attributes:
• cannot be modelled: represented only by simple component attributes in basic relational model
Example: notation in use
• Relation Schema: STUDENT(Name, SSn, Home_Phone,...Gpa)
• Relation (state) above: s(STUDENT)={t1,t2, t3, t4, t5}
• Tuples in s (five altogether):
t1 = <Benjamin Bayer, 305-61-2345,....3.21>
...
t5 = <Barbara Benson, 533-69-1238,....3.25>
• Alternative notation: t3.Age = 25, or t4[Age] = 28
Constraints in the Relational Model
• Restrictions on the actual values in a database state (not all combination of values in a table is a permitted state)
• Four main categories of constraints:
1. Implicit constraints (they are inherent in the model)
2. Schema based or explicit constraints (they are defined when defining the relational model)
3. Application rules, or semantic constraints (cannot be expressed in the model, must be enforced by the applications using the database)
4. Data Dependencies (more on this after Xmas)
Implicit constraints
• Given by the very definition of relational model:
• We have to design (think of) data in a certain way only because we are committed to using the relational model, and we need to stick to the definitions
• for example:
• No two tuples can have the same combination of values for all their attributes
• Each value in a tuple must be atomic
Schema Based (explicit) Constraints
1. Domain Constraints
2. Key Constraints
3. Constraints on NULLs
4. Entity Integrity Constraints
5. Referential Integrity Constraints
Domain constraints: data types
• Numeric data types for integers and real numbers
• Characters
• Booleans
• Fixed-length strings
• Variable-length strings
• Date, time, timestamp
• Money
• Other special data types (also defined by the user)
Using the right data type• allow more meaningful operations
• e.g. text fields cannot be used for mathematical calculations
• exclude some errors
• e.g. inserting text when a number is required
• or inserting impossible dates such as 34/04/2014, or 29/02/2013
• make storage more efficient
• e.g. by choosing an appropriate number sub-type (byte, integer, long integer, single or precision) the space occupied by the field (and the whole file) can be dramatically reduced
• make quicker data recall, as the greater the file, the slower the query
Keys: definition• Superkey (SK)
• No two distinct tuples in any state r of R can have the same value for SK
• Key (K)
• a Key is a Superkey of R such that, removing any attribute A from K, leaves a set of attributes K that is not a superkey of R any more
• Candidate key
• Relation schema may have more than one key
• Primary key
• Designated among candidate keys
• Notation: underlined attribute
Constraint on Keys
• Two distinct tuples in any state of relation cannot have identical values for (all) attributes in the primary key
• Other candidate keys are designated as unique keys
• so that the property of uniqueness of attribute combination can be enforced
NULLs• Represent the value of attributes that may be unknown or
may not apply to a tuple
• it’s a “special” value, not just an empty cell, we’ll see this later
• Meanings for NULL values
• Value unknown
• Value exists but is not available
• Attribute does not apply to this tuple (also known as value undefined)
• A constraint on an attribute will specify whether a NULL value is permitted for that attribute
• e.g. Keys will typically set be not NULL
Entity Integrity
• We need to be able to identify individual tuples in a relation
• for searching purposes, but more importantly for referring to other tuples when we implement relationships
• Entity Integrity Constraint: no primary key value can be NULL
pretty basic so far...
• we looked at constraints that apply to single relations
• a database will normally include many relations
• for rationalising data
• as an implementation of the entity-relationship conceptual model
University Database
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
how many problems can you identify with this table?
University Database
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
• REDUNDANCY:
• name, department, etc. stored many times: this wastes disk space, and slows down query processing
• have to add all of the lecturer’s information every time a course is taught
University Database
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
• TYPOGRAPHICAL:
• a mistyped StaffNo would be identified as a different lecturer
• is the mistyped StaffNo existed, that lecturer would be recorded as teaching the wrong course
5235244
University Database
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
• CONSISTENCY:
• the same data can be entered in different ways
• by different users, or the same user in different occasions
Computer Sc.
University Database
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
• UPDATE:
• a single occurrence of update (e.g. Computer Science changing location) has to be repeated over many records
Ashton Str.
University Database
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
• MODIFICATION ANOMALIES:
• deletion anomaly: deleting the 3rd row removes also the fact that COMP552 is a Computer Science course
• insertion anomaly: cannot add information about new lecturers who have yet to start teaching a course
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
Some problems solved:
• have removed some redundancy
• no need to include all of the Lecturers details each time we add a new teaching duty
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
Some problems solved:
• have removed some update problems
• changes to a Lecturer details need to be done only once
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
Some problems solved:
• insertion anomaly:
• can add new Lecturers before they are assigned Courses (or even if they do not teach at all)
4626737 MATH103 1 Mathematics
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Peach StreetPeach Street
Peach Street
Peach Street
Address
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
97592124626737
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
Course
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDutiesSemester
Some problems solved:
• Deletion anomaly?
• still there! Also, still have too much redundancy and some update problems
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
COMP102 2 Comp. ScienceComp. ScienceCOMP507 1
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103 1 Mathematics
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
PROBLEM SOLVED:
• have removed redundancy
• no need to include neither all of the Lecturer details nor all of the Course detail each time we add a new teaching duty
• no need to include all of the Department details when adding a new lecturer
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
PROBLEM SOLVED:
• have removed update problems
• changes to a Lecturer, a Course, or a Department details need to be done only once
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
PROBLEM SOLVED:
• insertion anomalies
• can add new Lecturers before they are assigned Courses (or even if they do not teach)
• can add new Courses before knowing which Lecturer will teach them
• can add new Departments before knowing their Lecturers
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
PROBLEM SOLVED:
• deletion anomalies
• can delete the fact that a Course is taught by a Lecturer, without losing information about the Course
• can delete a Lecturer without losing information about a Department
We’ve also gained in efficiency
• find the address of the Department offering MATH103
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06 Peach Street
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
4626737
Course
COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
9759212
19026837 Kate Smith 1.06 Mathematics Abercromby COMP100 Comp. Science4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
COMP507
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06 Peach Street
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
4626737
Course
COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
9759212
19026837 Kate Smith 1.06 Mathematics Abercromby COMP100 Comp. Science4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
COMP507
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06 Peach Street
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
4626737
Course
COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
9759212
19026837 Kate Smith 1.06 Mathematics Abercromby COMP100 Comp. Science4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
COMP507
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06 Peach Street
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
4626737
Course
COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
9759212
19026837 Kate Smith 1.06 Mathematics Abercromby COMP100 Comp. Science4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
COMP507
1stName 2ndName Office
Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08Floriana Grasso 2.08
Department
Comp. ScienceComp. ScienceComp. ScienceComp. Science
Comp. SciencePaul Dunne 6.03Comp. ScienceDean Jones 2.06 Peach Street
Peach Street
Peach Street
Peach StreetPeach StreetPeach Street
AddressStaffNo
5235234523523452352345235234
4626737
Course
COMP352COMP552COMP102
COMP102COMP507
Comp. ScienceComp. ScienceComp. ScienceComp. Science
CourseDep.
Comp. ScienceComp. Science
Sem.
1222
21
9759212
19026837 Kate Smith 1.06 Mathematics Abercromby COMP100 Comp. Science4626737 Dean Jones 2.06 Comp. Science Peach Street 1MATH103 Mathematics
COMP507
Have analysed 7+8=15 tuples, for a total of 15x9=135 values (assume equal length)
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Departments
Comp. Science
Abercromby
We’ve also gained in efficiency
• find the address of the Department offering MATH103
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Department Address
English Chatham Street
Peach Street
Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
4626737 MATH103
Lecturers
TeachingDuties
Departments
Comp. Science
Abercromby
Have analysed 5+3=8 tuples, for a total of (5x3)+(3x2)=21 values (assume equal length)
We’ve also gained in efficiency
• find the address of the Department offering MATH103
Foreign Keysreferences to records in another table using that table’s primary key
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
FOREIGN KEY
relates to:
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
FOREIGN KEY
relates to:
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
FOREIGN KEY
relates to:
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Referential Integrityforeign keys must only contain values which are represented in the primary key
4626737 Dean Jones 2.06 Comp. Science
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
Lecturers
5252624 Alan Turing 1.11 Artificial Intelligence
?
4626737 Dean Jones 2.06 Comp. Science
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
Lecturers
5252624 Alan Turing 1.11 Artificial Intelligence
?
4626737 Dean Jones 2.06 Comp. Science
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
Lecturers
5252624 Alan Turing 1.11 Artificial Intelligence
?
University DB catalog• The database comprises 4 relations:
1. LECTURERS (StaffNo,1stName,2ndName,Office,Department)
2. DEPARTMENTS (Department,Address)
3. COURSES (Course,Semester,CourseDep)
4. TEACHINGDUTIES (StaffNo,Course)
• where the following referential constraints exist:
1. TEACHINGDUTIES.StaffNo references LECTURERS.StaffNo
2. TEACHINGDUTIES.Course references COURSES.Course
3. LECTURERS.Department references DEPARTMENTS.Department
4. COURSES.CourseDep references DEPARTMENTS.Department
Expanding our definition• a Relational database schema S is
• a Set of relation schemas S = {R1, R2, ..., Rm}
• where each relation schema Ri is defined as we saw before
• together with a Set of integrity constraints IC
• a Relational database state is:
• Set of relation states DB = {r1, r2, ..., rm}
• where each ri is a state of Ri
• such that the ri relation states satisfy all the integrity constraints specified in IC (we say it’s a valid database state)
Referential Integrity
• Specified among two relations
• maintains consistency among tuples
• Foreign key rules:
• The attributes in FK have the same domain(s) as the primary key attributes PK
• Value of FK in a tuple t1 of the current state r1(R1) either occurs as a value of PK for some tuple t2 in the current state r2(R2) or is NULL
Other Types of Constraints
• Semantic integrity constraints
• May have to be specified and enforced on a relational database
• Use triggers and assertions
• More common to check for these types of constraints within the application programs
Other Types of Constraints (cont’d.)
• Functional dependency constraints
• Establish a functional relationship among two sets of attributes X and Y
• Value of X determines a unique value of Y
• State constraints
• Define the constraints that a valid state of the database must satisfy
• Transition constraints
• Define how to deal with state changes in the database
Update Operations, Transactions, and Dealing with
Constraint Violations• Operations of the relational model can be categorized
into retrievals and updates
• Basic operations that change the states of relations in the database:
• Insert
• Delete
• Update (or Modify)
The Insert Operation
• Provides a list of attribute values for a new tuple t that is to be inserted into a relation R
• Can violate any of the four types of constraints
• If an insertion violates one or more constraints
• Default option is to reject the insertion
The Delete Operation• Can violate only referential integrity
• If tuple being deleted is referenced by foreign keys from other tuples
• Restrict
• Reject the deletion
• Cascade
• Propagate the deletion by deleting tuples that reference the tuple that is being deleted
• Set null or set default
• Modify the referencing attribute values that cause the violation
The Update Operation
• Necessary to specify a condition on attributes of relation
• Select the tuple (or tuples) to be modified
• If attribute not part of a primary key nor of a foreign key
• Usually causes no problems
• Updating a primary/foreign key
• Similar issues as with Insert/Delete
The Transaction Concept
• Transaction
• Executing program
• Includes some database operations
• Must leave the database in a valid or consistent state
• Online transaction processing (OLTP) systems
• Execute transactions at rates that reach several hundred per second
Relationships• by splitting information in tables, we are establishing relationships
among data
• we are NOT creating connections between relations explicitly, but only by means of references
• relationships between tables always use the foreign keys
• primary keys are unique
• foreign keys uniquely refer to a record in another table
• therefore we know exactly how to reconstruct the information in the original, unique table
• foreign key fields can have any name, but they are usually given the same name as the corresponding primary key they refer to
• foreign keys must have the same data type as the the corresponding primary key they refer to
Types of relationship• Different kinds of relationship can exist in relational databases:
• one-to-many relationships (one tuple may be related to more than one tuple, but not vice versa)
• for example: one Department may have many Lecturers (but one Lecturer belongs to only one Department)
• many-to-many relationships (one tuple may be related to more than one tuple, and vice versa)
• for example: one Lecturer may teach several Courses, and the same Course may be taught by more than one Lecturer
• one-to-one relationships (one tuple is related to one other tuple only)
• for example, when University policy allows one Lecturer to teach at most one Course, and each Course to only have one Lecturer
Constraints on the FK• one-to-many relationships:
• the values of the foreign key (FK) of one table must be present among the values of the primary key in the other table for the relation to exist (“referential integrity”)
• not symmetrical: can have value in the primary key that are not in the FK (individuals which are not related to others, e.g. Departments that do not have Lecturers...)
• one-to-one relationships
• referential integrity
• FKs cannot contain duplicate values
• not symmetrical - can have value in the primary key that are not in the FK
Constraints on the FK• many-to-many relationships:
• no special constraint a part from referential integrity
• cannot be implemented directly: they are rendered by composing two one-to-many relationships
• need an intermediate table
• for instance: the table “TeachingDuties” signifies that:
• one Lecturer can have many Teaching Duties (one-to-many relationship)
• one Course may be part of many Teaching Duties (one-to-many relationship)
• therefore Lecturers and Courses are in a many-to-many relationship
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
many-to-many relationships
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Course
many-to-many relationships
Derived relationshipsStaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Derived relationships
There is a (derived) many-to-many relationship between Lecturers and Departments they teach for
StaffNo 1stName 2ndName Office
Floriana Grasso 2.08
Department
Comp. Science5235234
Comp. SciencePaul Dunne 6.039759212
4626737 Dean Jones 2.06 Comp. Science
Lecturers
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP352COMP552COMP102
COMP102COMP507
StaffNo
5235234523523452352345235234
97592124626737
TeachingDuties
4626737 MATH103
Derived relationshipsDepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP507COMP507
RB7O29D
LectTheatre
Lecture TheatresCapacity
1007550
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP507COMP507
RB7O29D
LectTheatre
Lecture TheatresCapacity
1007550
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
Course
COMP507COMP507COMP507
RB7O29D
LectTheatre
Lecture TheatresCapacity
1007550
Derived relationshipsDepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course
COMP507COMP507COMP507
RB7O29D
LectTheatre
Lecture TheatresCapacity
1007550
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
There is no many-to-many relationship between Departments and Lecture Theatre allocations
However, there is a one-to-many relationship between the two
DepartmentsDepartment
Comp. Science
Address
English Chatham Street
Peach Street
Mathematics Peach Street
Course
COMP507COMP507COMP507
RB7O29D
LectTheatre
Lecture TheatresCapacity
1007550
Course Semester
COMP507 1COMP352 2COMP552COMP102
22 Comp. Science
Comp. ScienceComp. ScienceComp. Science
CourseDep.
Courses
MATH103 1 Mathematics
?