## Relational Database OR Relational Model-(Part-3)

#### Relations –

Let A_{1}, A_{2},….,A_{n} be the attributes with domains D_{1}, D_{2}, …, D_{n}.

A relational schema R consists of set of attributes with their corresponding domains.

A relation r is a set of n tuples(A_{1}:d_{1}, A_{2}:d_{2}, …, A_{n:}d_{n}) such that d_{1} ε D_{1}, d_{2} ε D_{2},…, d_{n} ε D_{n}.

We write the relation as a table in which the column headings correspond to attributes and then write the values chosen from the appropriate domains into the rows or tuples.

So, we think of the n-tuples as having the form(d_{1}, d_{2}, …, d_{n}). Thus we conclude that a relation in the relational model a relation in the relational model can be viewed as any subset of the cartesion product of the domains of the attributes.

#### Properties of a relation –

- In a Table, the order of rows and Columns is immaterial.
- There will be no duplicate rows in a table.
- Each row of the table contains only one value.
- Value in each column in the table must come from the same attribute domain.

#### Degree and Cardinality :

###### Degree of a relation –

**Degree** of the relation is the number of columns in the table.For example, the degree of the employee relation is 5.

A relation with one column is called **unary relation. **A relation with two columns is **binary relation **and with three columns is** ternary relation ** and so on. Similarly, if a Table or a relation have n columns, them the relation will be called as **n-ary relation**.

###### Cardinality of a relation –

**Cardinality** is the number of rows in the table.

For example, the cardinality of the employee relation is 4.

#### Representation of Relational Database or Model Structures –

A database consists of any number of relations. For example, the Relation will be like STUDENT, CLASS, FACULTY, ENROLLMENT etc present in a database.

The relation schemes is represented by giving the name of the relation followed by its attribute names in parenthesis. For example,

1. STUDENT(sid, sname, subject, marks) 2. CLASS(coursesID, facultyID, courses, room) 3. FACULTY(facultyID, fname, dept) 4. ENROLLMENT(courseID, sid, grade)

#### Extensions and Intensions –

A relation in a relational database or model has 2 components –

**Extension****Intension**

###### Extension –

The set of tuples appearing at any instant in a relation, is called the extension of that relation. In other words, instance of Schema is the extension of a relation. The extension varies with time as instance of schema or the value in the database will change with time.

###### For Example :

###### Intension –

The intension is the schema of the relation and thus is independent of the time as it does not change once created. So, it is the permanent part of the relation and consists of –

**Naming Structure –**Naming Structure includes the name of the relation and the attributes of the relation.**Set of Integrity Constraints –**The Integrity Constraints are divided into Integrity Rule 1 (or entity integrity rule), Integrity Rule 2 (or referential integrity rule), key constraints, domain constraints etc.

###### For example :

Employee(EmpNo Number(4) Not NULL, EName Char(20), Age Number(2), Dept Char(4) )

*Reference : https://en.wikipedia.org/wiki/Relational_database*

Previous | Home | Next |

Schema and Instance in DB Relational Model (Part2) |
Database Keys in DBMS |

### Incoming search terms:

- Degree andcardinality in dbms
- the difference between intention and extension in database