Relational Data Model Flashcards
Relational model
A relational model is a way of organizing data in a database using tables, where each table represents an entity or concept in the real world, and each row in the table represents a specific instance of that entity. The data in each row is organized into columns, with each column representing a specific attribute or characteristic of the entity.
The key feature of the relational model is the ability to establish relationships between tables based on common attributes, known as keys. These relationships enable users to retrieve data from multiple tables simultaneously, providing a powerful tool for data analysis and reporting.
Relation
A relation is a mathematical concept based on the ideas of sets.
Informally, a relation looks like a table and typically contains a set of rows
Attribute name
Corresponds to the column header and gives an indication of the meaning of the data items in that column.
Key of a relation
A set of one or more attributes that uniquely identify each time in the relation.
Artificial key/surrogate key
A key added to a relation for the sole purpose of serving as a primary key. An artificial key is not based on any meaningful pour natural attributes of the data but it’s instead generated or assigned by the DBMS.
Schema of a relation
The structure or blueprint of the relation. It defines the attributes and make up the relation, their data types and any constraints or relationship between them.
CUSTOMER(cust_id, cust_name, address, phone)
Domain
A set of values with a specific data type and take off valid values.
It’s a constraint on the values that can be stored in an attribute of a relation.
Tuple
A single record or insurance of a relation.
It consists in a set of attributes values that correspond to the attributes of the relation.
State of a relation
The set of all tuples currently stored in the relation.
The state of a relation can change as tuples are inserted, updated our deleted from the relation.
Notation relation
R(A1, A2)
Let dom(A1)={0,1}
Let dom(A2)={a,b,c}
Then dom(A1) X dom(A2) is all possible combinations: {<0,a>, <0,b>, <0,c>, <1,a>, <1,b>, <1,c>}
For r(R) {<0,a>, <0,b>, <1,c>}
r(R)C dom(A1) X dom(A2) has three two tuples
Tuple Notation
t[Ai] or t.Ai
Constraints
- Inherent or Implicit contraints
- schema-based or Explicit contraints
- Application-based contraints or semantic contraints
Contraints
Conditions that must hold on all relation states
What are the three main types of explicit schema based constraints
- Key constraints
- entity integrity constraints
- Referential integrity constraints
+ Domain constraints