1
Rule 7: Rule of Set level insertion, update and deletion
A single operation should be sufficient to retrieve, insert, update and delete the
data.
Rule 8: Rule of Physical Data Independence
Batch and end user operations are logically separated from physical storage and
respective access methods.
Rule 9: Rule of Logical Data Independence
Batch and end users can change the database schema without having to recreate it
or recreate the applications built upon it.
Rule 10: Rule of Integrity Independence
Integrity constraints should be available and stored as metadata in data dictionary
and not in the application programs.
Rule 11: Rule of Distribution Independence
The Data Manipulation Language of the relational system should not be concerned
about the physical data storage and no alterations should be required if the physical
data is centralized or distributed.
Rule 12: Rule of Non Subversion
Any row should obey the security and integrity constraints imposed. No special
privileges are applicable.
2
devise will suit the company requirement. It is hardware that is an interface between
end users and database so it needed to be of best quality.
4.Storage Structure and Access Method Definition :- The DBA decides how the
data is to be represented in the stored database.
5.Approving Data Access :-The DBA determines which user needs access to
which part of the database. According to this, various types of authorizations are
granted to different users.
7.Backup and Recovery:- Database should not be lost or damaged. The DBA
ensures this periodically backing up the database on magnetic tapes or remote
servers. In case of failure, such as virus attack database is recovered from this
backup.
Hash Organization
1. Bucket: - A hash file stores data in bucket format. Bucket is considered a unit of
storage. A bucket typically stores one complete disk block, which in turn can store
one or more records.
2.Hash Function :-A hash function, h, is a mapping function that maps all the set of
search keys K to the address where actual records are placed. It is a function from
search keys to bucket addresses. The hash function can use any of the column
value to generate the address. Hash function uses primary key to generate the hash
index – address of the data block. Hash function can be simple mathematical
function to any complex mathematical function. We can even consider primary key
itself as address of the data block. That means each row will be stored at the data
3
block whose address will be same as primary key. This implies how simple a hash
function can be in database.
Cache:- This is the most costly and fastest form of storage. Usually very small, and
managed by the operating system.
Main Memory:- The storage area for data available to be operated on. General-
purpose machine instructions operate on main memory. Contents of main memory
are usually lost in a power failure or system crash occurs. Main memory may contain
many megabytes of data and it is generallly too small to store entire database.
Optical storage:- The most popular form of optical storage is CD-ROM. Data is
stored optically on a disk and are read by laser. The optical disk used in CD-ROM
storage cannot be written and can be loaded into or removed from a drive. Another
version of optical storage is write once or read many(WORM) disk which allows data
to be written once but does not allow them to be erased and rewritten, this medium is
used for archival of data.
Tape Storage: It is used primarily for backup and archival data. It is cheaper, but
provide much slower access because the tape must be accessed sequentially from
the beginning. For this reason the tape storage is referred to as sequentially access
storage. Used as protection from disk failures. Tapes have a high capacity and can
be removed from the tape drive facilitating cheap archival storage.
4
(The storage hierarchy of physical storage devices where the higher levels are
expensive(cost per bit),fast(access time) but the capacity is smaller.)
5
Consistency:-The database must remain in a consistent state after any transaction.
No transaction should have any adverse effect on the data residing in the database.
If the database was in a consistent state before the execution of a transaction, it
must remain consistent after the execution of the transaction as well.
Durability:-The database should be durable enough to hold all its latest updates
even if the system fails or restarts. If a transaction updates a chunk of data in a
database and commits, then the database will hold the modified data. If a
transaction commits but the system fails before the data could be written on to the
disk, then that data will be updated once the system springs back into action.
Isolation:-In a database system where more than one transaction are being
executed simultaneously and in parallel, the property of isolation states that all the
transactions will be carried out and executed as if it is the only transaction in the
system. No transaction will affect the existence of any other transaction.
ROLLBACK statement:- If you wished to rollback (undo) any changes made to the
database since the last commit, you can issue the command: ROLLBACK;
Lock Based Protocol: - Lock is in other words called as access. In this type of
protocol any transaction will not be processed until the transaction gets the lock on
the record. That means any transaction will not retrieve or insert or update or delete
the data unless it gets the access to that particular data .These locks are broadly
classified as Binary locks and shared exclusive locks.
6
Binary lock:- In binary lock data can either be locked or unlocked. It will have only
these two states. It can be locked for retrieve or insert or update or delete the data or
unlocked for not using the data
Exclusive lock :- In this technique the data is said to be exclusively locked if for
insert, update ,delete. When it is exclusively locked no other transaction can read or
write the data.
Shared Lock:-When a data is read from the database, then its lock is shared i.e.;
the data can be read by other transaction too but it cannot be changed while
retrieving the data.
Two phase locking protocol:- In this type of protocol, as the transaction begins to
execute, it starts requesting for the locks that it needs. It goes on requesting for the
locks as and when it is needed. Hence it has a growing phase of locks. At one stage
it will have all the locks. Once the transaction is complete it goes on releasing the
locks. Hence it will have descending phase of locks. Thus this protocol has two
phases – growing phase of locks and shrinking phase of locks.
Suppose there are two transactions T1 and T2. Suppose T1 has entered the system
at time 0005 and T2 has entered the system at 0008 clock time. Priority will be given
to T1 to execute first as it is entered the system first.In addition to the timestamp of a
transaction, this protocol also maintains the timestamp of last ‘read’ and ‘write’
7
operation on a data. Based on the timestamp of transaction and the data which it is
accessing a timestamp ordering protocol is defined.
8
9
8. ER Diagram for maintaining all patient visit to hospital including
their detail and billing
ID Name Disease
Visited Hospital
Patient
to
Bill By
Bill By
Department
Department
Treats
Type Room no
Treatment
Type Prescription
10
9. ER Diagram that show a relationship between employee and
organisation
Name
No of Emp
ID Add
Name Dep
Name Code
ID Name Date
Age
Enroll
Student Course
By
Is Taught
BY
Name
ID Add
11
Instructor