In our previous sessions, we've been some what brief to the relational database models. Toady, we'll have an in detail examination of what is what. Basically, in R DBMS everything that is data before is now a relation. Hence, a relational database consists of relation aka tables which have rows and columns.
- Rows are called Tuples.
- Columns are called attributes.
- Number of rows in a table constitute the cardinality.
- Number of columns in a table constitute the arity.
- The intersection of a row and a column is called a cell.
- Entity
- Attribute
- Relation
Problem: a Student Joins in a College
Model:
There are principally 3 types of relationships, by their nature. They are:
- One-to-One
- One-to-Many/ Many-to-One
- Many-to-Many
The Above problem can be modified to all the types like:
a Student Joins in a College (1-1)
many Students Join a College (m-1)
many Students Join many Colleges (m-m)
Another important element in the construction of a database, is the selection of the keys. A key is an attribute of a relation that uniquely identifies each tuple. For example if we take all the students information in a relation, then obviously student roll number or his admission number or his registration number will be unique of each student. hence they are all alternatives for the key.
One such attribute selected is called a Primary Key. If two relation have a common key that uniquely identifies its Tuples, is called a foreign key. This is similar to a Parent-Child relationship in class and objects concept: inheritance. If two or more keys are combined in case of forming a single key for a table, its called a composite key. Hence there are:
- Primary Key
- Foreign Key
- Composite Key
- Candidate Key
- Referring the Problem
- Identifying the Entities, attributes and Relations
- Framing a model for the problem
- Mapping the model for our database table.
No comments:
Post a Comment