Professional Documents
Culture Documents
# Data:-
Data is a collection of row facts related with the
elements, objects or an entity.
It includes facts, figures, letters, words charts,
symbols, audio, video or any combinations.
This process is known as data processing.
The data collected from the user will be processed
to generate some information.
# Information:-
Information is the processed data that will give
some useful facts or meaning.
Information is useful in decision making process.
Information can be a data for next level of
processing.
In this way a processed data is re-used to generate
further information which is known as information
processing.
# Characteristics of information
As mentioned in definition of information, it must
give some meaning, so information must have some
characteristics, they are;
Subjectivity:
The information must be highly subjectively as
there may be verities of data collected.
The data of two person or object or elements may
be matched but the information must be specific
to the concerned only.
Relevance:
The information must be relevant that is pertinent
and meaningful to the decision maker.
Right information for the right person will help in
decision making process.
Timeliness:
The information must be delivered on time as well.
Right information on right time will help in
decision making.
Accuracy:
The information provided to make a decision must
be accurate.
Wrong information may lead to wrong decision
which will be harmful for the organization.
Completeness:
The information provided to make a decision
making process must be complete.
Uncompleted information may guide you towards
the wrong decision.
Accessibility:
The information generated must be accessible for
the decision making process.
The information will be valueless if it is not
accessible by the decision maker in right format at
the right time.
Classification:
These collected data will be classified into
different stages as required or convince.
Summarizing:
These data will be processed and becomes
information, which can be summarized and
represented to get desire result.
# Limitation
Database of the
Loan Processing Flat file processing system;
Server 3
Application
Application
Server 2
# Database approach;
In a flat filing system, various types of problems
and limitations are there. These all types of problems
can be solved very easily using the database system.
It will store all the data contains in the centrally
located storage section and accessed through
different applications. Some basic task such as
Preparation, Insertion, updating, retrieval, deletion,
backups and restores etc works are performed very
efficiently. The data processing approach is
presented as below;
# Advantages of Modern Database Management
System;
Data redundancy can be removed as several
repeated data are removed and established a link
to access these data.
Data inconsistency will be avoided as the similar
data elements which may give different meaning
will be collected separately.
Sharing of the data between the users is very
easily possible.
I will maintain the standard format of the report as
desire by the user.
Different level of security level is maintained which
will make a database task highly secure even in
network.
The data values collected in database is accurate
and consistent. (Integrity constringes are satisfied.)
It provides multiple users environment and
interfaces for the users.
Easy relationship among the data entity or objects
within the database or other databases.
Backup and recovery provision makes it highly
secure as we can recover the data loss from
backups.
# Database Architecture:
Centralizing DBMS Architecture:
In centralized DBMS architecture, data contains
are stored in a centrally located server and
accessed by various dumb terminals known as
client.
These clients will access the database through the
application program.
Each client will get access permission from the
DBA and have to work accordingly.
Database structure of a single institution with
multiple nodes
Magnetic
Storage
Section
Server Application
Data server
Database
Server
Database
Storage
Application Application
Database Schema:
A Schema describes the view at each level. A
Schema is an outline or a plan that describes the
records and relationships existing in the view. The
schema also describes the way in which entities at
one level of abstract can be mapped to the next
level. The overall design of the database is called
database schema.
A database schema includes:
* Characteristics of data items such as entities and
attributes.
* Logical structure and relationship among those
data items.
* Format of storage representation.
* Integrity parameters such as physically
authorization and backup politics.
Since each view is defined as schemas, there are
three levels of schemas. At lower level one Physical
Schema, at middle level one Conceptual Schema and
at higher level several Sub-Schemas.
Each user group refers to its own sub-schema. The
DBMS transforms a request specified on an external
schema into conceptual schema and then into that
request forwarded into the internal schema for
processing over the database. The process of
transforming the request and results between the
levels is called mapping.
Data independence:
* Data Independence is major objectives of the
database system which will be implemented through
three levels of schema.
* The change made in one level does not affect the
application or definition at the other level is termed
as data independence.
Logical data independence is the ability to modify
the logical schema without causing application
program to be rewritten or any change to the
external schema. When data is added or removed,
only the view definition and the mapping need to be
changed in the DBMS that supports logical data
independence.
Physical data independence is an ability to modify
the internal schema without causing any changes the
external schema and without causing application
program to be re written.
# Data models:
* The physical or logical structure of the database is
termed as database model.
* It is a conceptual tool to describe the data, data
relationships, data semantics, and data
constraints.
* Two major types of data models are used where as
it is believed that evolution of data models are still
in progress.
# Object based data model:
* Object based concept is based on the data, data
relationship.
* It is gaining wide acceptance for their flexibility
structuring capabilities.
* Various data integrity constraints can be specified
explicitly by using the objects based model.
Entity Relationship and Object Oriented Model are
two database model based on object.
Relational model
* It was derived by E.F Coded in 1970 and was
considered as important concept in DBMS.
* It is based on the mathematical notations of a
relation, consisting of rows and column of data.
* The column names are termed as attributed
(Fields) and rows are treated as tuples (Record).
* For each relation there is a set of attributes that
uniquely determines the tuples, this is called key.
* It relieves the user from details of storage
structure and access methods.
* It is based on the relation of the database
elements and popular as RDBMS.
# Data Dictionary and Database Language;
Data Dictionary is a set of specific table in a special
file where schema descriptions are stored. It contains
the metadata about the structure of the database.
Data Dictionary is used very heavily, that’s why great
emphasis should be placed on developing a good
design and efficient implementation of the data
dictionary. Using a compiler and linker, data dictionary
will access during the processing of the queries.
In order to provide the various facilities to
different types of user, a DBMS provides one or more
specialized programming languages called Database
Languages. This language can be called as Structured
Query Language (SQL) which has been taken as a
standard database language. Database language comes
in different forms, which are categorized based on
different level of abstraction facilities provided by
DBMS.
System Structure:
# Storage Manager:
Storage manager is a program module that provides
the interface between the low level data stored in the
database and the application programs and queries
submitted to the system. The storage manager is
responsible for the interaction with the file manager.
The raw data stored on the disk using the file system,
which is usually provided by a conventional OS. The
storage manager translates the various DML
statements into low level file system commands.
Storage manager is responsible for storing, retrieving
and updating data in the database. The storage
manager component includes;
* Authorization and Integrity Manager, which tests
for the satisfaction of integrity constraints and
checks the authority of user to access data.
* Transaction Manager, which ensure that the
database remains in a consistent (correct state)
despite system failure and that concurrent
transaction executions proceed without
conflicting.
* File Manager, which manages the allocation of
space on disk storage and the data structure used
to represent information stored on disk,
* Buffer Manager, which is responsible for fetching
data storage into main memory and deciding what
data to cache in main memory. The buffer
manager is a critical part of the database system
since it enables the database to handle the data
sizes that are much larger than the size of main
memory.
Query Processor:
The query processing components are:-
DDL Interpreter, which interprets DDL statements
and records the definitions in the data dictionary.
* DML Compiler, which translates DML statements
in a query language into an evaluation plan
consisting of low level instructions that query
evaluating engine understand.
* Query Evaluation Engine, which executes low level
instructions generated by DML complier.
# Entity Relationship (E-R) Model:
The ER data model is based on the real world that
consists of a set of basic objects called entities and of
relationships among these objects. It was developed to
facilitate database design by allowing the specification
of an enterprise schema, which represents the overall
logical structure of the database. The ER model is one
of several semantics data model: the semantics aspect
of the model lies in its representation of the meaning
of the data. The ER model is very useful in mapping the
meaning and interaction of real world enterprise onto
a conceptual schema.
The ER model is well suited to data modelling for use
with database. It is fairly abstract and is easy to discuss
and explain. ER models are readily translated to
relations. ER modelling is based on two concepts:
Entity (Things or objects)
Relationship (association among the several
entities)
# Mapping Cardinalities:
Mapping cardinalities, or cardinality ratio, express
the number of entities to which another entity can
be associated via a relationship sets. Mapping
cardinalities are most useful in describing binary
relationship sets, although occasionally they
contribute to the description of relationship sets that
involve more than two entity sets.
For a binary relationship set R between entity sets
A and B, the mapping cardinality must be one of the
following;
One to one:
An entity A is associated with at most one entity
in B and an entity in B is associated with at most
one entity in entity A.
One to many:
An entity A is associated with any number of
entities in B. An entity in B however can be
associated with at most one entity in entity A.
Many to one;
An entity A is associated with at most one entity
in B. An entity in B however can be associated with
any number of entities in entity A.
Many to many;
An entity A is associated with any number of
entities in B and an entity in B is associated with
any number of entities in A.
One to One One to Many
Many to Many
* Keys fields:
We must have a way to specify the entities within
the entity sets distinguished. Two entities in an entity
set are not allowed to have exactly same values for all
the attributes. A key allows us to identify a set of
attributes that suffice to distinguish relationships from
each other.
Super Key is a set of one or more attributes that
taken collectively allow us to identify uniquely an
entity in the entity set. Soc Sec No, Symbol No,
Cuts No etc are some key fields used as super key.
Attributes.
Attributes.
Sets.
Cardinality Constraints:
One-to-One;
One-to-Many;
Many-to-One ;
Many to Many;
Exercises
Cache memory:
Cache is a fastest and most expensive types of
memory used in a computer.
It will maintain the gaps between processor and
main memory.
While processing Cache act as a high speed buffer
between CPU and main memory.
It holds the very active and instantly used data and
instructions temporarily.
While processing,
CPU will search the data
contains first in
Cache and then in
main memory.
Main Memory;
The storage area, where data and instructions are
stored while working.
CPU will access the data and instructions stored.
Semiconductor memories and volatile in nature (Will
hold data contain till electricity is present.)
Generally small in size and expensive too.
RAM and ROM are used as main memory in
computer.
Flash Memory;
A semi conductor type memory which is also called
EEPROM.
The data stored in flash memories could survive
power failure.
Accessing data in flash memory is little bit
complicated.
(To read data in takes 10 nano sec and 4-10 micro
sec to write.)
To overwrite the data, it erases the old data then
writes new data.
It became very popular due to its small size and
accessibility.
Random Access:
Data will be stored or accessed directly from the
stored location.
It is also termed as direct access method.
It is one of the fastest methods for data accessing.
Magnetic Disk, Core memories/ Flash memories are
common examples.
Different types of File Allocation Tables are used to
allocate the storage location even in this method (As
similar in Index sequential Method).
# File organizations:
A file is organized logically as a sequence of
records. These records are mapped onto disk blocks.
Files are provided as a basic construct in operating
systems (OS), so we shall assume the existence of an
underlying file system. We need to consider ways of
representing logical data models in terms of files.
Although, blocks are of a fixed size determined by the
physical properties of the disk and OS, record sizes are
varied. In RDBMS, tuples of distinct relations may be of
different sizes.
One approach to mapping database to files is to use
several files and to store records of only one fixed
length in a given file. An alternative is to structure files
to accommodate variable length records (Fixed length
is easier to implement). Many of the techniques used
for the former can be applied to the variable length
case. Thus we begin by considering a file of fixed length
records.
# Introduction:
A Relational database is a set of database elements
collected in a table. Each of which is assigned a unique
name. The table structure is very similar to the
structure of ER database structure. A row in a table
represents a relationship among the set of values. As a
table is a collection of such relationships, there is a
close correspondence between the concept of table
and the mathematical concept of relation, from which
the relational data model takes its name. In what
follows, we introduce the concept of relation.
Relationship represents facts describing a set of real
world entities. In a relationship, we represent one
entity per row and one attributed per column. Table
name and the column name are used to help in
interpreting the meaning of the values in each role of
relation.
Database example:
Roll Std_Na D_o_B Faculty Semes
No me ter
BBA- Rabindr 12/21/1 Managem VI Sem
0015 a 989 ent
6-
009
BSc- Laxmi 09/11/1 Science IV Sem
0017 990
6-
010
BA- DilBhad 01/09/1 Humaniti III Sem
0045 ur 991 es
4-
010
: : : : :
: : : : :
Domain;
Domain defines a set of values that are allowed in an
attributes to collect. Whatever set of data elements
such as numbers, alphabets, data in format, logical
etc that we collect in an attributes is a domain.
Domain is a data type that we collect in an
attributes. Different attributes may have same
domain in an entity.
Null Value;
The elements that we collect as an attributes cannot
be blank or empty which is termed as null value. We
cannot keep the attributes blank or null.
Tuple:
Every set of elements in a relation where relative
data will be collected is known as Tuple. It is a
collection of data elements of an object or person.
Tuple is also known as Record. No of records is also
called cardinality of the relation. Each attributes of
tuples may have same value but two duplicate tuples
are not allowed.
# Database Schema:
Database schema is a logical design of the
database that we set for extracting the data
elements from the database.
Database instance is a snapshot of the data in the
database at a given instant in time.
Relation schema is a list of attributes in a specific
order (Logical design). It doesn’t contain any tuples.
The concept of relational schema corresponds to
the programming language notation of type
definition. The concept of a relation instance
corresponds to the programming language to the
value of a variable. The value of the variable may
change with time similarly the contents of a relation
instance may change with time as the relation is
updated.
Constraints:
A Constraint is a rule that restricts the values that
may be present in the database. There are several
constraints that are used to check the validations of
the data in a relational database. They are:
o Entity Integrity Constraints:
o Referential Integrity Constraints:
Key Fields:
We must have a way to specify the entities within
the entity sets distinguished. Two entities in an
entity set are not allowed to have exactly same
values for all the attributes. A key allows us to
identify a set of attributes that suffice to distinguish
relationships from each other.
o Super Key is a set of one or more attributes that
taken collectively allow us to identify uniquely an
entity in the entity set. Soc Sec No, Symbol No,
Cust No etc are some key fields used as super key.
Query Language:
A query language is a language in which a user
requests information from the database. These
languages are usually on a level higher than that of a
standard programming language. Query language
can be categories as either procedural or non
procedural. In a procedural language, the user
instructs the system to perform a sequence of
operations on the database to complete the desired
result. In a non procedural language, the user
describes the desire information without giving a
specific procedure to obtain that information.
Most commercial relational database system
offers a query language that includes elements of
both the procedural and non procedural approaches.
SQL (Structural Query Language), QBE (Query by
Example), Quel, Datalog etc are some common query
language.
The relational algebra is procedural language
where as the tuple relational calculus and domain
relational calculus are non procedural. These query
language illustrates the fundamental techniques for
extracting the data from the database.
# Relational Algebra:
Relational algebra is a procedural query language. It
consists of a set of operations that one or two relations
as input and produce a new relation as their result. The
fundamental operations in the relational algebra are
Select, Project, Union, Set difference, Cartesian
product and Rename. In additional to the fundamental
operations, there are several other operations namely
Set Intersection, Natural Join, Divide and Assignment.
These operations will be defined in terms of the
fundamental operations.
Relational algebra operation manipulates relations.
This is these operations use one or two existing
relations to create a new relation. This new relation
may then be used as input to a new operation. This
powerful concept- the creation of new relations from
old ones- makes possible an infinite variety of data
manipulation.
The select, project &rename operations are called
unary operations, because they operate on one
relational. The other 3 operations operate on pair of
relations and are therefore binary operations.
* Select Operation :( σ)
The select operations selects tuples that satisfies a
given predicates (conditions). A symbol Sigma (σ) is
used to denote select operation. A tuple from the
source relation is selected (or not) based on whether it
satisfies a specified predicate. A predicate is a truth
valued expression involving tuple component values
and their relationships. The predicates appears as a
subscript to σ. The argument relation is given in
parentheses following the σ. All tuples satisfying the
predicate are then collected into the resultant relation.
General Syntax of selection is;
RelationRelationUnionIntersectionDifference
R N RUN R∩N R-N
X Y Z X Y Z X Y Z X Y Z X Y Z
A i u a j v a i u a j v a i u
A j v b k w a j v b k w
B k w b q s a j v d e f
D E f d e f b k w
b k w
b q s
d e f
d e f
* Join Operation ( )
Join is a binary operation that allows the user to
combine two relations in a specific way. Join of two
relations is restriction of their Cartesian product of R
and N such that a specific condition meets. Join is
normally defined on an attribute from same domain.
From R relation a attribute (R.a) and from N relation b
attribute (N.b) are joined with specific condition (R.a
N.b). The specified condition is called join predicate
of attributes.
# Kinds of relation:
A relational algebra operation has been extended
in several ways. A simple extension is to allow
arithmetic operations as part of projection. An
important extension is to allow aggregate operations
such as computing the sum of the elements of a set, or
their average. Another important extension is the
outer join operation, which allow relation algebra
expressions to deal with null values, which model
missing information.
* Generalized Projection;
The generalized projection operation extends the
projection operation by allowing arithmetic functions
to be used in the projection list. The generalized
projection operation has the form:
Π F1, F2,……,Fn (E)
Where E is any arithmetic algebra expression, and
each of F1, F2,……,Fn is an arithmetic expression
involving constants and attributes in the schema of E.
As a special case, the arithmetic expression may be
simply an attributes or a constant.
Π ename, salary + 500 (Employee)
The attribute resulting from the expression salary
+ 500 does not have a name. We can apply the rename
operation to the result of generalized projection in
order to give it a name. As a notational convenience,
renaming of attributes can be combined with
generalized projection.
* Aggregate Function:
The aggregate functions take a collection of values
and return a single value as a result. For example, the
aggregate functions sum takes a collection of values
and returns the sum of the values. Some of the
commonly used aggregate functions are SUM, AVG,
COUNT, MAX, MIN, DISTINCT etc.
The general form of the aggregate is as follows;
SUM (Salary (PAYROLL))
AVG (Salary (PAYROLL))
COUNT (NAME (EMPLOYEE))
MIN (Salary (PAYROLL))
MAX (Salary (PAYROLL))
The general form of the aggregate operation (Ʋ) is
as follows;
G1, G2,……,GnƲ F1 (A1), F2 (A2),……,Fm(Am)
(E)
Where E is any relation-algebra expression, G1,
G2, … …Gn constitute a list of attributes on which to
group, each Fi is an aggregate function, each Ai is an
attribute name.
The tuple in the result of expression E are partitioned
into group in such a way that:
1)All tuples in a group have the same values for G1,
G2,...…,Gn.
2)Tuples in different groups have different values for
G1, G2,……,Gn.
In generalized projection, the result of an
aggregatei0on operation does not have name. We
can apply rename operation to the result in order to
give it a name.
* Outer Join;
The outer join operation is an extension of the
joint operation to deal with missing information. In
both the “theta and natural join”, the tuples that have
similar values will not displayed, which may result the
data lost. To retain all the information of both
relations, it is describe to have a join which keeps the
tuples having no corresponding values in both relations
associated with null values. This is the external join or
outer join. The outer join is extended into following:
* Null Value:
Operations and comparisons of null values has to
be avoided. Null values mean values unknown or
nonexistent. Any arithmetic operation involving null
values must return null value as result. Any comparison
with null value results in special value called unknown.
# Modification on database:
We express database modifications by using the
assignment operations. We make assignments to
actual data relation by using same notation as in
assignment.
* Deletion:
We can delete only whole tuples, we cannot
delete values on only particular attributes, in relational
algebra a deletion is expressed by:
R←R–E
In above example R is a relation and E is a
relational algebra query. While resulting, an algebraic
query E is been removed from R relation.
* Insertion:
To insert data into a relation, we either specify a
tuple to be inserted or write a query whose result (a
set of tuples) will be inserted. Both the attributes must
belong to same domain. In relational algebra an
insertion operation is expressed by:
R←RUE
In above example R is a relation and E is a
relational algebra query. A resulting tuples from
relational algebraic query E is been inserted into
relation R. Both the attributes of the relation and
algebraic query must belong to same domain.
* Updating:
In a relation, when we have to change a value of a
particular attributes, we have to update the tuple or
attributes. We can use generalized projection operator
to do this task. Various predicates (conditions) can be
applied while updating the values of the tuples.
Temp1← Πename, eadd, salary +salary *0.10, Job
Status
(σ dept=Account (employee))
In above example salary will be increased by 10%
of all the employees whose dept is Account.
Temp2 ← Πename, eadd, salary +salary *0.10, Job
Status
(σ dept=Account (employee)) U
Πename, eadd, salary +salary *0.05, Job
Status
(σ Age >= 45 (employee))
In above example the salary will be increased by
10% if dept is account and salary increased by 5%
those whose age is greater than 45.
# Views:
In all of our examples we operated on logical
model. For security reason or for personalized
collection it may not be described to show the entire
relation to a user. Certain data may be hidden from
certain users.
Any relation that is not part of the logical model, but
is made visible to a user as a virtual relation, is called
view. It is possible to support a large no of views on top
of any given set of actual relations.
* View Definition;
We define a view using the create view statement;
Exercise
1)What is relation? Explain with the components
related with the relation?
2)What is database schema? Differentiate between
relation schema and relation instance.
3)What is constraint? Differentiate between Entity
Integrity Constraints and Referential Integrity
Constraints.
4)What is key field? Explain various types of keys used
to in relationship.
5)What is relational algebra? List out the operations
used in a relational algebra.
6)Give an expression in the relational algebra for the
following queries.
a. Select all names from the relation employee.
b. Select Name, Address, Phone, Dept from the
relation Employee.
c. Select Name, Address, Phone, Dept who works in
account department.
d. Select Name, Address, Phone, Dept who works in
account department and earns more than 25000.
Unit 5: Integrity Constraints
# Introduction:
As a security is major features of the database, we
must make sure that the change done by the user is
authorized and may not have any types of error even
accidently. To ensure the security and integrity
constraint is very much useful.
Integrity constraints provides a means of ensuring
that changes made to the database by authorized users
do not result in a loss of data consistency. Thus
integrity constraints guards against accidental damage
of the database.
In general, an integrity constraint can be an arbitrary
predicates pertaining to the database. However
arbitrary predicates may be costly to test. Thus, we
usually limit ourselves to integrity constraints that can
be tested with minimal overhead.
* Domain Constraints:
Domain constrain specifies that the values of each
attributes must be atomic value from the domain of
the respective attributes. It will make the distinct
data collections in an attributes as well as ensure the
test query comparison makes sense. Data is said to
be domain integrity when the value of a column is
derived from the domain.
Domain constraints are the most elementary form
of integrity constraint. They are tested easily by the
system wherever a new data items is entered into
the database. It is possible to have several attributes
with similar domain. For example, the attributes Emp
Name, Std Name, Cust Name might have same
domain.
* Referential Integrity:
In a relational model, data elements data are stored
in different relations and they are linked together while
extracting accordingly. For eg In a PERSONAL relation
all the detail of the student will be stored, and in a
PARENTS relation detail of the parents are stored. If we
have to find the detail of the parents, we will link these
two relations through a unique and common attribute
(PAR_ID) among them. The attribute PAR_ID is set as a
primary key in a PARENTS table where as it is termed
as Foreign key in PERSONAL relation. Now we will
search the detail of the parents with relation to.
Here the foreign key is supposed to have relevant
values of the primary key or a null value. Other values
beside these two are not allowed. If the tuple does not
have any relevant values to the parent primary key
field, it is termed as orphan record.
Check Constraints;
Check constraint is used to verify the satisfaction
of the value entered. The value entered in an
attributes must have a value within the specified
range or that satisfied the specific condition. The
syntax of check constraints is
[Constraint <name>] CHECK (<condition>)
For example:
CREATE TABLE employee
(………,
E_ID Integer CONSTRAINT chk empid
CHECK (E_IDIS NOT NULL and E_ID<10000),
Dept Char (3) CONSTRAINT Chk_dept
CHECK (value in (“ACC”, “ADM”, “MAN”,
“DIR”, “TEC”, “HLP” )),
… … … );
Here in above example, an attributes will have a
specific value range less than 1000 and the field
should consist null value. Other attribute has a value
of ACC, (Accountant), ADM (Administration), MAN
(Manager), DIR (Director), TEC (Technical) and HEP
(Helper). Beside these values other values are not
allowed.
Assertions:
An assertion is a predicate expressing a condition
that we wish the database always to satisfy. Domain
constrains and referential integrity constraints are
special forms of assertions. However, there are many
constraints that we cannot express by using only
these special forms. Some examples of such
constraints are;
* Every loan has at least one customer who
maintains an account with a minimum balance of
1000.
* The sum of all loan amounts for each branch must
be less than the sum of all account balance at the
branch.
An assertion in SQL takes the form
CREATE ASSERTION <assertion name> CHECK
<predicate>
Triggers:
A trigger is a statement that the system executes
automatically as a side effect of a modification to the
database. To design a trigger mechanism, we must
meet two requirements.
* Specify when a trigger is to be executed. This is
broken up into an event that cause the trigger to
be checked and a condition that must be satisfied
for the trigger execution.
* Specify the action to be taken when the trigger
executes.
Once we enter into a trigger into a database, the
database system takes on the responsibility of
executing it whenever the specified event occurs and
the corresponding condition is satisfied.
Triggers are useful mechanism for altering humans
or for starting certain task automatically when
certain conditions are met. An example of use of
trigger, suppose a warehouse wishes to maintain a
minimum inventory of each items; when an
inventory level of an item falls below the minimum
level, an order should be placed automatically. This
is how the business rule can be implemented by
trigger. On an update of the inventory level of an
item, the trigger should compare the level with
minimum inventory level for the item and if the level
is at or below the minimum, a new order is added to
an orders relation.
# Security and integrity violation:
Database integrity is more related with the security
of the database. The data stored in a database are
supposed to be protected from unauthorized access
and destructions or alteration. The data alteration may
be caused by intentional or accidental.
Intentional data loss may caused by the following:
Unauthorized reading of data (theft of
information).
Unauthorized modification of dat.
Unauthorized destruction of data.
Accidental data loss may be caused from:
Crashes during transaction process.
Usual data loss during the distribution of data over
several computers.
Usual data loss during the updating the database.
Logical errors that may occur during the
assumption that transaction preserve the data
base consistency constraints.
It is easier to protect against accidental loss of data
that to protect against intentional data loss in the
database. Intentional data loss protection may be
costly as well as high alertness over the un-authorized
access is also required. Database security usually refers
to protect against intentional data loss, whereas
integrity refers to the avoidance of accidental loss of
data on the database.
The dividing line between security and integrity is
not always clear. The security generally refers to both
of these. To protect the database, we must take
security measure at several levels;
Database system:
Some database-system users may be
authorized to access only a limited portion of the
database. Other users may be allowed to issue
queries, but may be forbidden to modify the data.
It is the responsibility of the database system to
ensure that these authorization restrictions are
not violated.
Operating System:
No matter how secure the database system is,
weakness in operating-system security may serve
as a means of unauthorized access to the
database. Due to the less security restriction by
the OS many problems may occur on the database
system.
Network:
Since almost all database systems allow
remote access through terminals or networks,
software-level security within the network
software is as important as physical security, both
on the Internet and in private networks. Granting
authority over the network may protect various
problems related to the security.
Physical:
Sites with computer systems must be
physically secured against armed or surreptitious
entry by intruders.
Human:
Users must be authorized carefully to reduce
the chance of any user giving access to an intruder
in exchange for a bribe or other favors.
Security at all these levels must be maintained if
database security is to be ensured. A weakness at a low
level of security (physical or human) allows
circumvention of strict high-level (database) security
measures.
Security within the operating system is implemented
at severallevels, ranging from passwords for access to
the system to the isolation of concurrent processes
running within the system. The file system also
provides some degree of protection. The
bibliographical notes reference coverage of these
topics in operating-system texts. Finally, network-level
security has gained widespread recognition as the
Internet has evolved from an academic research
platform to the basis of international electronic
commerce. The bibliographic notes list textbook
coverage of the basic principles of network security.
We shall present our discussion of security in terms of
the relational-data model, although the concepts of
the security are equally applicable to all data models.
# Encryption Techniques:
There are a vast number of techniques for the
encryption of data. Simple encryption techniques may
not provide adequate security, since it may be easy for
an unauthorized user to break the code. As an example
of a weak encryption technique, consider the
substitution of each character with the next character
in the alphabet. Thus,
Perry ridge
Becomes
Qfsszsjehf
If an unauthorized user sees only “Qfsszsjehf,” she
probably has insufficient information to break the
code. However, if the intruder sees a large number of
encrypted branch names, she could use statistical data
regarding the relative frequency of characters to guess
what substitution is being made (for example, E is the
most common letter in English text, followed by T, A,
O, N, I and so on).
A good encryption technique has the following
properties:
It is relatively simple for authorized users to encrypt
and decrypt data.
It depends not on the secrecy of the algorithm, but
rather on a parameter of the algorithm called the
encryption key.
Its encryption key is extremely difficult for an
intruder to determine.
# Authentication:
Authentication refers to the task of verifying the
identity of a person/software connecting to a
database. The simplest form of authentication consists
of a secret password which must be presented when a
connection is opened to a database.
Password-based authentication is used widely by
operating systems as well as databases. However, the
use of passwords has some drawbacks, especially over
a network. If an eavesdropper is able to “sniff” the data
being sent over the network, she may be able to find
the password as it is being sent across the network.
Once the eavesdropper has a user name and password,
she can connect to the database, pretending to be the
legitimate user.
# Arranging Tuples;
* ORDER BY (Arranging in Ascending or Descending
Order);
SELECT emp_no, e_name, e_add FROM employee
ORDER BY b_sal;
SELECT emp_no, e_name, e_add FROM employee
ORDER BY b_sal (DESC);
# Set operation;
In SQL various types of SET operators are also
used. Some of them are;
* UNION operator;
Syntax: -<Query1> UNION <Query2>
Eg:- SELECT * FROM employee;
UNION
SELECT * FROM employee1;
* UNION ALL operator;
Syntax: -<Query1> UNION ALL <Query2>
Eg:- SELECT * FROM employee;
UNION ALL
SELECT * FROM employee1;
* INTERSECT operator;
Syntax: -<Query1> INTERSECT <Query2>
Eg:- SELECT * FROM employee;
INTERSECT
SELECT * FROM employee1;
* MINUS operator;
Syntax: -<Query1> MINUS <Query2>
Eg:- SELECT * FROM employee;
MINUS
SELECT * FROM employee1;
# Sub Queries;
Syntax: -SELECT <col_name1, col_name2, … … …,
col_nameX>
FROM <table_name>
WHERE (<SUB QUERY>);
Eg:- SELECT emp_no, e_name, e_add FROM
employee;
WHERE
(SELECT * FROM employee
WHERE DEPT= “Kathmandu”);
SELECT emp_no, e_name, e_add FROM
employee;
WHERE
(SELECT * FROM employee
WHERE DEPT=
(SELECT * FROM employee
WHERE (emp_id<110)));
Unit 7: Query Processing
# Introduction to query processing:
# Equivalence of expressions:
# Query optimization:
# Query decomposition:
Unit 8: Object Oriented Model
# Introduction:
# Design of object oriented model:
Unit 9: Application of Database System in
Organization
# Submission of the database system report of any
one commercial organization:
(Such as Financial, Accounting, Payroll, Inventory,
Ticketing, Banking, Online banking etc)