3. Relational Model - 3marks Flashcards
What is the relational model (background and four basic concepts)?
Background: • Introduced by E.F. Codd in 1970. • Many DBMS products based on this model (but few completely implement it). • Based on sound theoretical foundation with a simple and uniform data structure: the Relation • Based on mathematical set theory. Four basic concepts: • Relations • Domains • Attributes • Tuples
A relation is (informally):
- a set of records
* similar to a table with columns and rows
What is the main construct for representing data in the relational model?
A relation
A Schema is…
- the meta-data, or data describing data
* specified during database design, and is not expected to change frequently
An Instance is
- the data in the database at a particular time
* created during data updates and change frequently
A domain is characterised by….
- a set of atomic values (ie: indivisible) (eg: the domain ‘Name’ has the set { Albert, Anna, …. Zoe }
- it’s specified data type or format
Domain data types of formats could include…
- integers
- real numbers
- fixed or variable length character strings
- date
- time stamp
- currency
- sub-range from a data type, e.g. 1 ≤ Grade ≤ 7
- enumerated data type, e.g. {‘Male’, ‘Female’}
An attribute is linked to a domain in that it is…
• the name of a role played by some domain in the relation named
Does the same attribute name imply the same domain?
• No. Two attributes could be called ‘code’ from different domains: eg: Subject.CODE and Lecturer.CODE.
Does a different attribute name imply a different domain?
• No. a different attribute name does not necessarily imply different domain (Domains for EID and SID can be the same, but the attribute names must differ.
A tuple is…
- n ordered list of n values
- where each value vi (1 i n) is an element of the corresponding domain of attribute Ai or a special value called “null”
- Usually shown as a row in DB.
Relations are sets of tuples. Do they have an order in a database?
- Not mathematically and practically - order is irrelevant.
* However, the physical storage has some partial ordering.
Relational database design is (one sentence) the process of:
• capturing the semantics of an application, and translating it into a relational database schema
What are some consequences of poor relational database design?
- Poor design can lead to redundant information in tuples and update anomalies.
- Can also result in inability to represent information and consequently, loss of information.
- Conceptual modelling, and other formal techniques, can assist a designer in obtaining good design characteristics.
Where are integrity constraints defined?
On the database schema.