Skip to main content

Record Based Logical Models

Record based Logical Models are used in describing data at the conceptual level and view level. They are used to specify the overall logical structure of the database and to provide a higher level description of implementation. Record based models are so called because the database is structured as fixed format records of several types. Each record type defines a fixed number of fields (or attributes) and each field is of fixed length. Record based data models do not include a mechanism for the direct representation of code in the database. But there will be separate languages that are associated with the models to express database queries and update. The three data models are Relational, Network and Hierarchical.

RELATIONAL DATA MODEL

The relational model represent data and relationship among data by a collection of tables, each of which has a number of columns with unique names. The entities and their relationship(in the ER model) are represented as two-dimensional tables. The mathematical concept underlying the relational model is the set theoretic relation, which is a subset of the Cartesian product of a list of domains. A row in a table represent a relation among a set of values, table is a collection of such a relationship.

RELATIONS

Given a collection of sets D1, D2,….., DN; R is a relation on these N sets ,if it is a set of ordered N-tuples < d1,d2,…,Dn > such that d1 belongs to D1, d2 belongs to D2, …... , dN belongs to DN. Sets D1, D2,….., DN; are the domains of R and N is the degree of R. A relation is any subset of the Cartesian product of one or more domains. We can represent a relation by a table. Table is similar to a conventional sequential file with rows of the table corresponding to records of the file and columns corresponding to the fields of the records.

STUDENT
Rollno Name House Place

108 BAIJU BLUE HOUSE IDUKKY
125 KAVITHA WHITE HOUSE MANJUMMEL
139 ZEENATH RED HOUSE VAIKOM
161 ARUN BLACK HOUSE EDAPPALLY

CARTISIAN PRODUCTS

Given a collection of sets D1, D2,……, DN the Cartesian product of these N sets denoted as D1 X D2 X ...X DN is the set of all possible ordered N tuples < d1, d2,…. , …….., dN > such that d1 belongs to D1, .... ,dN belongs to DN . ie D1 X D2 X .... X Dn = {(d1, d2, .... , dN) / d1  D1 , d2  D2, ……., dN  DN}
For example, if D1 = {1,2,3} D2 ={4,5} then D1 X D2 = {(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)} .

TUPLE

Each row of the table represent one N—tuple or tuple of the relation .ie the members of a relation are called tuples. Each tuple represents an entity in the entity set.

CARDINALITY

The number of tuples in a relation is called the cardinality of the relation (the number of rows in a table)

DEGREE OR ARITY

Each relation that is a subset of D1 X D2 X ………X DN is said to have degree N or ARITY N. ie degree means the number of attributes (columns) in a relation(table).

COMPONENTS - A tuple (d1, d2, .... , dN ) is said to have N components and the ith component is di.

ATTRIBUTE - Columns of a table are called attribute. Attributes are significant characteristics or properties of the entity that helps to identify an entity. The actual content of the attribute or quality of the attribute is called attribute value.

DOMAIN - Domain is a pool of values from which the values for a given column (attribute) must be chosen.

RELATION SCHEME - The set of attribute names of a relation is called a relation scheme. If A1, A2,……,AN , are the attributes of a relation R then we write the relation scheme as R(A1, A2, ..., AN); and R(A1, A2, ..., AN) = {A1, A2, ..., AN} For example ,if Roll No, Name and Date of birth (DOB) are the attributes of a relation Student, then the relation scheme for Student is {Roll No, Name, DOB} and we write the relation scheme as Student (Roll No, Name, DOB). The collection of relation scheme used to represent information is called relational data base scheme. The current value of the corresponding relations is called the relational database. Relations of degree 1 is called unary relations, degree 2 is binary, 3 is ternary and N is N-ary relations. (The relational model is also called flat file.)

PROPERTIES OF A RELATION
With any one relation,
1) There will not be any duplicate rows - Relation is a set of tuples and it will not have any duplicate elements. In a conventional file two identical records can exist.
2) Row order is insignificant. Column order is insignificant.
3) All the values are atomic ie. they cannot be split further, without loss of information.
4) All the values in a column are the values of the same attribute.


SUPER KEY
- A set of one or more attributes (columns), whose values when taken collectively can uniquely identify a tuple(a row) in a relation (table).

CANDIDATE KEY - A super key for which no proper subset is a super key is called candidate key.

PRIMARY KEY - A candidate key which is used as the principal means for identifying tuples in a relation.

SECONDARY KEY (REGULAR KEY) - A key which identifies a set of tuples (rows / records) in a relation (table / file), or tuples having a certain property or common values for the different attributes (columns or fields) of that key. A secondary key does not identify a tuple uniquely.

CONCATENATED KEY OR COMPOSITE KEY - If the primary key is formed by the combination of more than one attribute, it is termed as concatenated key.

ALTERNATE KEY - A candidate key that is not the primary key is called an alternate key. A relation can have only one primary key and any number of candidate keys.

FORIEGN KEY - An attribute or a set of attributes of a relation R1 is termed as a foreign key, if its values can be either null or values in the primary key (candidate key) of some other relation, say R2. Consider the STUDENT table with attributes RollNo., Name, Class, Place, Sex, DOB; and the CLASSES table with attributes classCode, and Description. RollNo is the primary key of STUDENT table and classcode is the primary key of CLASSES table. Class is a foreign key for the STUDENT table whose referenced key is classCode in CLASSES table. (Refer the tables given as examples for Referential Integrity)

PRIMARY DOMAIN

A domain is a primary domain, if and only if there exists some single attribute primary key defined on that domain. Example: Consider the table ITEM with attributes - ItemCode, ItemName, SUPPLIER with attributes - SupplierCode, SupplierName, PURCHASE with attributes ItemCode, SupplierCode, Qty, and CUSTOMER with attribute Name, Place, HouseName. If ItemCode is the primary key of ITEM table, SupplierCode is the primary key of SUPPLIER table, {ItemCode, SupplierCode} is the primary key of PURCHASE, and {Name, HouseName } is the primary key of CUSTOMER, then the domains of ItemCode, SupplierCode are primary domains. But the domains of Name or HouseName are not Primary domains.

EXTENSION & INTENSION

The extension of a given relation is a set of tuples appearing in the relation at a given instant (instance of a relation) The extension varies with time, i.e., it changes as tuples are added, modified or deleted. Extension is the temporary or changing part of a relation. {The current content of the database or the content of the database at any instant is called instance of the database.} The intention of a relation is the permanent part of a relation (ie. the relation scheme). The intention of a given relation is independent of time. The intention defines all permissible extensions. The intention is the combination of a naming structure and a set of integrity constraints. Naming structure consists of the relation name plus the names of attributes, each with its associated domain name. The integrity constrains can be divided into Key Constraints, Referential Constrains and Other Constraints.

Comments

Popular posts from this blog

KTU-FOSS LAB Solutions

Write shell scripts to show the following  ( you can write menu driven programs)
 Currently logged user and his logname ( logname)  Your current shell ( echo $SHELL)  Your home directory ( echo $HOME)  Your operating system type (echo $OSTYPE)  Your current path setting ( echo $PATH)  Your current working directory ( echo $PWD )  Show Currently logged  users ( w or who -H)      Show only the user name of logged users in the host ( users)      Details of last login ( last cek....where cek is the user id )  About your OS and version, release number, kernel version ( uname -a or  cat  /proc/version)  Show all available shells ( cat /etc/shells )  Show mouse settings (cat  /sys/class/input/mouse*/device/name )  Show computer CPU information       CPU details      ( cat /proc/cpuinfo | more )       Show information on  CPU architecture ( lscpu)       Number of Processor core ( nproc)  Show memory information       Memory details ( cat /proc/meminfo | more )       Display file system disk usage ( d…

Important Directories and Files

Important Directories
/bin                            holds the “essential” Linux commands and utilities /boot                          holds files required for boot process (kernel, vmlinuz, grub) /dev                            holds device files (hard drive, USB, CD-ROM, etc.) /etc                             holds system configuration files /etc/init.d                    holds scripts to start/stop network services /etc/rc.d                     holds system startup/shutdown scripts /etc/X11                      holds configuration files for X-windows /home                        holds user home directories (except for the root account) /lib                               holds system/shared library files /lost+found                holds files restored after system crash /mnt                            used as temporary mount point for CD-ROM, floppy, etc. /opt                              typically where large software applications are installed /proc                           holds kerne…

ER Diagrams to Table

REDUCING E-R DIAGRAM TO TABLE - A database which conforms to an E R diagram can be represented by collection of tables .For each entity set and for each relationship set in the database, we will create unique tables, which is assigned the name of the corresponding entity set or relationship sets . Each table has a no. of columns which have unique names. Each row in the table corresponds to an entity or a relationship.

REPRESENTATION OF STRONG ENTITY SET -Let E be a strong entity set with descriptive attributes a1, a2....aN . We represent this entity by table called E with N distinct columns, each of which corresponds to one of the attributes of E.

REPRESENTATION OF RELATIONSHIP SET - Let R be a relation ship set involving entity set E1,E2....En Let attribute(R) consists of 'm' attributes We can represent this relation ship set by a table called R with m distinct columns, each of which corresponds to one of the attributes in attribute (R) plus the primary key of E1..En.

REPRESENTI…