Tuesday, April 20, 2010
Oracle for B.sc Student part 3
UNIT II
Note on Oracle For B.Sc Final Year Student Nagpur University.
Relational model and relational database design:
Relational model: Relational model represent a database as a collection of relations. The data is representing in the form of table. The relational model concerned with three aspects of data. (1) Data structure. (2) Data integrity. (3) Data manipulation.
In relational model a row is called as a tuple, a column is called as attribute and a table is called as relation. The data type describing the tuples of values that can be appear in each column is called domain.
Domain: A domain is a set of atomic values. Atomic values means each values in the domain is individual as for as the relational model is concerned. A common method in specifying a domain is to specify a data type from which the data values forming domain are drawn. A domain is a form which specific attribute of specific relation drawn their actual values. A primary key is unique identifier for the tuple. That is at any given time no two rows of a table contain the same values in that column or column combination.
Null values: A null value is the value given to an attribute in a tuple of attribute is unapplicable or its value is unknown. The null value can be obtained at a latter time.
*Relational Algebra: It is a collection of operation that are used to manipulate entire relations. These operations are used as an example to select tuple from individual relations and to combine related tuples from individual relations and to combine related tuples from several relations, for the purpose of specifying a query a retrieval request on the database. Relational algebra operations are divided into nine operations.
(1) Union: Union is a relational algebra operation that creates the situation of two compatible relations. It is denoted by (U). To be an union compatible the two table should have same attribute (fields) i.e. same set of columns. Consider two tables A and B which contain Roll no. and Names. These tables are union compatible.
(2) Intersection: Intersection includes all tuples that are in both tables intersection is the commutative operation. It is denoted by (∩). In other word it is a relational algebra operation that creates set intersection of two union compatible relations.
Table A ∩ B
(4) Cartesian (Cross product): It is also known as cross product and used to combine tuples from two relations. So that related tuple can be identified. Consider two table A1 and B1. If A1 has nA1 the resultant A1×B1 has nA1*nB1 tuples. Thus the Cartesian product creates tuples with combine attributes of two relations.
(5) Select: Select is a relational algebra operation that uses a condition to select rows from a relation. A relation is created between tables if it satisfies specified condition. Syntax: select from table. Where condition, it also uses “<” or “>”, “=”, “≤”, “≥” operators.
For example: select from emp where emp_no>1005.
(6) Project: It is a relational algebra operation that creates a relation by deleting unwanted column project creates a new a relation by removing columns from an existing relation. Syntax: Table_name over (column_name)
for example: consider the table in ifg:1-1. By using project relational algebra we chose a column whatever we want. Project, emp over (emp_name, salary).
(7) Divides: It is a relational algebra operation that creates a new relation by selecting a row in a one relation that match every row with another relation. It is reverse of product operation. It is easy to verify that if a relation is a product of two relation x and y then we can obtain x by dividing the product by y i.e. (x*y)/y=x.
(8) Assignment: It gives a name to a relation. For example: In a statement, A: select (student: student_ID: ‘ramana’)
Where A is being assigned to the result of select operation.
<<< previous page Next Page>>>