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.
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
Post a Comment