Relational Data Model Flashcards
What is a Database Schema?
Database Schemas
• A database schema is a set of relation
schemas
• A relation schema has a name, and a set
of attributes (+ types):
Explain difference between Schema vs Instance
Explain how you go from Schema to Database.
Why should we have relations in databases?
Why relations?
• Relations often match our intuition
regarding data
• Very simple model
• Has a good theoretical foundation from
mathematics (set theory)
• The abstract model underlying SQL, the
most important database language today
Explain Keys
What are composite keys?
What are the things to avoid when construction databases?
Things to avoid!
• Redundancy
• Unconnected relations
• Too much decomposition
Describe a database schema
A database schema is a blueprint
- Consists of a set of relations e.g. Courses(code, name, teacher)
where “Courses” is the relation name and code, name and teacher are
attributes.
What are tuples?
A database instance holds actual data
- Tuples are instances of a relation.
- E.g. (‘TDA357’, ‘Databases’, ‘Mickey’)
In a DBMS, a table holds relations where:
- Each row holds a tuple
- Each column stores a different attribute
What is a DBMS?
Data Base Management System
What are keys?
Keys uniquely identify the other values of a tuple in a relation
- Composite keys combine several attributes
What is the Entity-Relationship approach
The Entity-Relationship approach
• Design your database by drawing a picture
of it – an Entity-Relationship diagram
– Allows us to sketch the design of a database
informally (which is good when
communicating with customers)
• Use (more or less) mechanical methods to
convert your diagram to relations.
– This means that the diagram can be a formal
specification as well
Which are the three main elements of an E/R diagram?
E/R Model
• Three main element types:
– Entity sets
– Attributes, and
– Relationships
What are entities?
What are Entities set?
What are Attributes?
What is a Relationship?
How to translate E/R to Schema?
Explain the usage of References
What is a Foreign Key?