You are on page 1of 4

Lecture Notes For DBMS and Data Mining and Data Warehousing

Lecture 9 Relational Model A relational database consists of a collection of tables, each of which is assigned a unique name. A row in table represents a relationship among a set of values. Table is a collection of rows or relationships which is similar to a mathematical relation i.e. a set of tuples. Basic Structure A mathematical binary relation is an association of values from one set to another set. Ex. Less-than relation associates a set of integers with another set of integer. Consider
1, 2, 3, 1, 2, 3,

A=

B=

Relationship less-than from A to B =

1, 2, 3,

1, 2, 3,

Or it can be represented as set of tuples <x,y> where x is an element from A and y is an element from B such that x<y i.e. Relationship less-than from A to B = {<1,2>,<1,3>,<1,4>,<2,3>,<2,4>,,<3,4>}. Similarly, Relationship equal-to from A to B= {<1,1>,<2,2>,<3,3>}. And Relationship greater than from A to B = {<2,1>,<3,1>,<3,2>,<4,1>,<4,2>,<4,3>} While the Cartesian product of A and B contains all such tuple <x,y> where x belongs to A and y belongs to B i.e. A B =
< 1,1 > < 1,2 > < 1,3 > < 2,1 > < 2,2 > < 2,3 > < 3,1 > < 3,2 > < 3,3 > ... ... ... ... ... ... ...

So we can see any relation from A to B above will be a subset of A B.


Department of Electrical and Electronics By: Sulabh Bansal

Lecture Notes For DBMS and Data Mining and Data Warehousing
Now Suppose in a relational model a table T has columns titled as A, B and C. If T is representing an entity set then A, B, C will be its attributes. Every attribute corresponds to a limited number of values that can be assigned to it. The set of values that can be assigned to a particular column is called domain for that. So A, B and C will have their specified domains. Suppose those domain sets are denoted as DA, DB, and DC. Any row of the table will have a value from D A in first column, DB in second column, and DC in third column. So a row of relational table is similar to a tuple of a mathematical relation between the sets DA, DB, and DC. For Example: Consider an BOOK table having attributes acc-no, title, and author. To make it simple we restrict the domain for acc-no. as A={100, 101, 102}, for title as B={DBMS, COMPILER, OS} and for author as C={Ramanuj, Aristotle and Silbershatz}. That means the first column of BOOK can have any value from only A, second from only B and third from only C. the Cartesian product of these domain sets can be represented in a tabular form as :
100 100 100 100 100 100 100 100 200 200 200 200 200 200 200 200 200 300 300 300 300 300 300 300 300 300 DBMS DBMS DBMS COMPILER COMPILER COMPILER OS OS DBMS DBMS DBMS COMPILER COMPILER COMPILER OS OS OS DBMS DBMS DBMS COMPILER COMPILER COMPILER OS OS OS Ramanuj Aristotle Silbershatz Ramanuj Aristotle Silbershatz Ramanuj Aristotle Ramanuj Aristotle Silbershatz Ramanuj Aristotle Silbershatz Ramanuj Aristotle Silbershatz Ramanuj Aristotle Silbershatz Ramanuj Aristotle Silbershatz Ramanuj Aristotle Silbershatz

ABC=

Department of Electrical and Electronics By: Sulabh Bansal

Lecture Notes For DBMS and Data Mining and Data Warehousing

Now we can observe any valid table representing the entity set BOOK for a library given above restriction on domains will have only a subset of the rows from the above table which represents A B C. For Example a valid entity set for all books in the library can be 100 DBMS Silbershatz BOOK
200 300 DBMS COMPILER Ramanuj Silbershatz

So we can say any table of relational model is actually similar to the mathematical relation. Every row of such relational table is similar to a tuple of a mathematical relation. Let the tuple variable t refers to the first tuple (first row) in above mentioned BOOK table then we can various elements of the tuple as t[acc-no]= 100, t[title]= DBMS and t[author] = Silbershatz. Query Languages A language in which a user requests information from the database is called a query language. o Procedural- user instructs the system to perform a sequence of operations on the database to compute the desired result. E.g. Relational algebra o Nonprocedural- user describes the information desired without giving a specific procedure for obtaining the desired information. E.g. tuple calculus, domain calculus.

Department of Electrical and Electronics By: Sulabh Bansal

Lecture Notes For DBMS and Data Mining and Data Warehousing

Department of Electrical and Electronics By: Sulabh Bansal

You might also like