Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 11

Homework Title / No.

: 01 Course Code :301

Course Instructor : - CHAVI RALHAN Course Tutor (if applicable) :

Date of Allotment :30-8-2010 Date of submission :


13/09/2010

Student’s Roll No. B33 Section No. : RC2802

Declaration:
I declare that this assignment is my individual work. I have not copied from any other
student’s work or from any other source except where due acknowledgment is made
explicitly in the text, nor has any part been written for me by another person.

Student’s Signature: Vinod Verma

Evaluator’s comments:
_____________________________________________________________________

Marks obtained: ___________ out of ______________________


PART-A

Question 1: Conceptually and diagrammatically describe the logical steps while executing users request
to access the database system.

Answer – A data model in software engineering is an abstract model that describes how data are represented
and accessed. Data models formally define data elements and relationships among data elements for a domain
of interest. According to Hoberman (2009), "A data model is a wayfinding tool for both business and IT
professionals, which uses a set of symbols and text to precisely explain a subset of real information to improve
communication within the organization and thereby lead to a more flexible and stable application environment
A user request for data is recevied by data manager which determine the physical record requird.The data
manager send the request for specific physical record to the file manager .the file manager decide which
physical bllock of secondary storage device contains the erquird record and send the appropieate block to disk
manager .The disk manager reterive the block and send it to the file manager ,which send the requird record to
the data manager.
The database managem is bridge between the application programmed
and the os of the computer which is responsible for placing data on the magnatic storage device.

To retrieve the data from database the following operation perforam-


1-a user issues an acess request, using some application programming or data manipulation language.
2-the application program detrimine what data are need and communicates the need to data base management.
3-the dbms intercepts the request and interprets it.
4-the database management system instruct the o s to locate and retrieve the data from the specific location on
the magnetic disk.
5-a copy of data is given to the application programme for processing.
6-the dbms inspects in turn the external schema the external mapping the conceptual schema the concepitual
mapping and storage structure definition.

Question 2: Construct a E-R diagram for a hospital management system with a set of doctors and a set of
patients.With each patient, a series of various tests and examinations are conducted. On the basis of
preliminary report patients are admitted to a particular specialty ward.

Answer – Entity relationship diagramming is a technique that is widely used in the world of business and
information technology to show how information is, or should be, stored and used within a business system.

For creating tha ER model of hospital management system we should follow the basic standard steps as
following-:
Step 1 find the entity related to management
List of entity
1. doctor
2. patient
3. test
4. ward

Step 2- in the second step we find the relationship degree and the cardinality between entity

Where m stands for many and n as same.

Step3- now fined the appropriate attribute for each entity


For doctor
1. doc_name;
2. Doc_id;
3. specialization
4. age

2-. Patient, list of attribute


1. patient_name;
2. diseases
3. blood group
4. address
5. patient_NO;

3- test ;list of attribute


1. test_name;
2. applied for
3. test conuctor
4.Test_id;
5.organ for;

4- ward ;list of attribute


1. ward _no;
2. ward_level;
3. ward_name;

Step 3 now we find the nature of each attributea well as find the primary key and foreign key.
1. for entity Doctor we select doc_id as primary key and spatialisation is as multivalue attribute
age is an drived attribute.
2. for patient , patient_id is an primary key address is an composite key,diseases is an multivalue attribute
.
3. for test entity test_name is an primary key and ‘organ for’ is an multivalue attribute.
4. for ward entity ward_NO+ward_lavel is a primary key which is actually is a composite key.
Question 3: Compare and contrast the different models?

Answer –Hierarchical
The hierarchical data model organizes data in a tree structure. There is a hierarchy of parent and child data
segments. This structure implies that a record can have repeating information, generally in the child data
segments. Data in a series of records, which have a set of field values attached to it. It collects all the instances
of a specific record together as a record type. These record types are the equivalent of tables in the relational
model, and with the individual records being the equivalent of rows. To create links between these record types,
the hierarchical model uses Parent Child Relationships. These are a 1:N mapping between record types. This is
done by using trees, like set theory used in the relational model, "borrowed" from maths. For example, an
organization might store information about an employee, such as name, employee number, department, salary.
The organization might also store information about an employee's children, such as name and date of birth.
The employee and children data forms a hierarchy, where the employee data represents the parent segment and
the children data represents the child segment. If an employee has three children, then there would be three
child segments associated with one employee segment. In a hierarchical database the parent-child relationship
is one to many. This restricts a child segment to having only one parent segment. Hierarchical DBMSs were
popular from the late 1960s, with the introduction of IBM's Information Management System (IMS) DBMS,
through the 1970s.
In flat files, records are deemed to exist at the same level. Hierarchical data files permits records to be grouped
together. This allows a superior-subordinate or parent-child relationship (a single one-to-many relationship) to
be defined between records. In simple forms, the superior or parent records are used to collect information that
is common to all the subordinate/child records of the same group. This has an immediate effect of reducing
redundancy with the data base.

Record "key" usually includes the "key" of all superiors/parents. Keys tend to recognize the order of a
particular record within a group rather than within the data file. Duplicate records are acceptable.
Examples: topical outlines, organizational telephone directories, Microsoft Windows registry, automated
report formats. Hierarchical data bases have a natural alignment with report formats, even if the information is
being extracted for data bases implementing other models.

Network:
The popularity of the network data model coincided with the popularity of the hierarchical data model. Some
data were more naturally modeled with more than one parent per child. So, the network model permitted the
modeling of many-to-many relationships in data. In 1971, the Conference on Data Systems Languages
(CODASYL) formally defined the network model. The basic data modeling construct in the network model is
the set construct. A set consists of an owner record type, a set name, and a member record type. A member
record type can have that role in more than one set, hence the multiparent concept is supported. An owner
record type can also be a member or owner in another set. The data model is a simple network, and link and
intersection record types (called junction records by IDMS) may exist, as well as sets between them . Thus, the
complete network of relationships is represented by several pairwise sets; in each set some (one) record type is
owner (at the tail of the network arrow) and one or more record types are members (at the head of the
relationship arrow). Usually, a set defines a 1:M relationship, although 1:1 is permitted. The CODASYL
network model is based on mathematical set theory.

While hierarchical data bases emphasize the use of a single "path" to access all records, network data bases may
provide multiple paths to locate individual records and sets of records. The term "network" has little to do with
communications between computers. Instead, the "network" refers to the ways in which records may reference
other records. The term "CODASYL" (from the abbreviated name of the group that formalized the use of such
data bases) is often used, but it does not connote the multi-relationship nature and is usually inaccurate.

Records and fields tend to be fixed in size, but are storable at arbitrary locations within the data file (or files).
The record "key" represents a physical location (e.g., file, block, and offset) in the data-base file structure.

Network data bases allows records to participate in multiple relationships or sets. Performance tends to be
extraordinarily efficient. A well-designed network data base would permit application programs and
extemporaneous queries simply to follow key links between records, without having to look individual records
up through a separate index or directory.
Because of the efficiency, this model tends to be followed in DBMS implementations (in constrast with DB
implementations) for disk storage. However, the network-like structure usually is hidden, quite deliberately,
from DBMS users.

Relational
(RDBMS - relational database management system) A database based on the relational model developed by
E.F. Codd. A relational database allows the definition of data structures, storage and retrieval operations and
integrity constraints. In such a database the data and relations between them are organised in tables. A table is a
collection of records and each record in a table contains the same fields.

Properties of Relational Tables:


 Values Are Atomic
 Each Row is Unique
 Column Values Are of the Same Kind
 The Sequence of Columns is Insignificant
 The Sequence of Rows is Insignificant
 Each Column Has a Unique Name

Certain fields may be designated as keys, which means that searches for specific values of that field will use
indexing to speed them up. Where fields in two different tables take values from the same set, a join operation
can be performed to select related records in the two tables by matching values in those fields. Often, but not
always, the fields will have the same name in both tables. For example, an "orders" table might contain
(customer-ID, product-code) pairs and a "products" table might contain (product-code, price) pairs so to
calculate a given customer's bill you would sum the prices of all products ordered by that customer by joining
on the product-code fields of the two tables. This can be extended to joining multiple tables on multiple fields.
Because these relationships are only specified at retreival time, relational databases are classed as dynamic
database management system. The RELATIONAL database model is based on the Relational Algebra.

Entity-Relationship (E-R)
Object/relational database management systems (ORDBMSs) add new object storage capabilities to the
relational systems at the core of modern information systems. These new facilities integrate management of
traditional fielded data, complex objects such as time-series and geospatial data and diverse binary media such
as audio, video, images, and applets. By encapsulating methods with data structures, an ORDBMS server can
execute comple x analytical and data manipulation operations to search and transform multimedia and other
complex objects.
The abstractness of the relational data model was an essential part toward eliminating the reliance of data
models upon machine implementations. However, the abstractness also obscured how tuples in one relation
were associated with tuples in other relations. In some ways, the entity-relationship model (or ERM, as long as
you don't confuse it with enterprise resource management) can be viewed as an extension of the relational
model where the associations between relations is made explicit. Relational purists have suggested that ERM is
totally unnecessary. Just the same, the entity-relationship model exists independently of the relational model
and should be judged on its own merits.

The ERM approach presumes that all information can be stored in entities and relationships between entities. A
"entity" is similar to a relation (of the relational data model), except that any references to other entities is
removed. This would include all foreign keys definitely and may include other association information as well.
What constitutes a tuple in the relational model is called an "entity instance" by ER purists. In practice, both
schematic entities and entity instances are considered "entities."

PART-B

Question 4: If WE want to change the schema of at one level of database system without having change
the schema of next higher level , is it possible , if yes representing using abstraction levels.
Answer-:-.A database is a collection of related data that have implicit meaning. Database represents some
aspect of the real world, they contain logically coherent data, and they are designed, built, populated for a
specific purpose. The DBMS architecture is a three-schema architecture, which was proposed to achieve
program data independence, support for multiple views, and use of catalog to store the database description
schema.
______________________________________________________________________________
The three-schema architecture is a convenient tool for the user to visualize the schema levels in a database
system. A displayed schema is called a schema diagram and each object in the schema is called schema
construct.
In this DBMS architecture, schemas can defined in three levels:
1:-INTERNAL

2:-CONCEPTUAL

3:-EXTERNAL

The internal level has an internal schema, which describes the physical storage structure of the database. The
internal schema uses physical data model, which describes the complete details of data storage, access paths for
the database, and how the data’s are retrieved or inserted in the database. A data model is a collection of
conceptual tools for describing the data, data relationship, data semantics and consistency constraints.

The conceptual level has a conceptual schema that describes the whole database for different users who access
the database. The conceptual schema hides the details of the physical storage structures and concentrates
basically on entities, relationships, and constraints. The external or view level includes a number of user views.
Each external schema describes the part of the database that a particular user group is interested in and hides the
rest of the database from other user groups. Implementation data model is used at this level. Each user group
will refer to its own external schema. Hence the DBMS should be capable of transforming the request specified
in the external schema into request against the conceptual schema. The process of transforming requests and
results between levels are called mappings.

Data independence is accomplished because, when the schema is changed at one level the schema at the next
higher-level remains unchanged only the mapping between the two levels is changed. View is also called as
“Virtual table” because view does not contain physically stored records and will not occupy any space. A multi-
user database whose users have variety of applications must provide facilities for defining multiple views. This
three-schema helps us to provide data security of data’s among different users accessing the database, ensures
data integrity and avoid duplication of data’s in the database. It helps us to establish and maintain relationship
among the data’s in the database

Question 5: Can we treat a relationship as a high level entity? Justify your answer with example?

Answer -If we talk about level of entity, relationship is also can be a entity which have different attribute and
relationship decide that how entity involved in relationship.so we can consider relationship as higher level
entity.
Relationship is an something which involves to no of table. it may be one two or three. So the relationship may
be an simple relationship or it may be an entity which have some attribute. now if relationship entity involves
two entity then the attribute of relationship may copy in any involves entity or in both entity . an relationship
can be consider as higher level entity because the attribute defined in higher level entity copy in in all inherited
entity according to specialization .

Question 6: A university has many academic unit named schools. Each school is administered by a Head
of School. The school has administrative and teaching staff. A school offers many courses. A course
consists of many subjects A subject is taught to students who have registered for a subject in a class room
by a teacher. Draw the necessary E-R diagram for the university specifying aggregation, generalization
or specialization hierarchy.
Answer – An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships
between entities in a database. ER diagrams often use symbols to represent three different types of information.
Boxes are commonly used to represent entities. Diamonds are normally used to represent relationships and
ovals are used to represent attributes.
For preparing the E-R model on university and related acadmic unites than again we follow the sequential
procedure as following:-

Step 1
Identify the entity set collecting in the database
Entity list
1. school
2. courses
3. subject
4. hod
5. teacher
6. head Of schools

Step2 Now identify the attribute and the type of attribute of different entity

entity school
1. school name
2. location
3. code-- primary key

entity courses
1. course_name
2. course_id
3. duration
4. content

entity subject
1. sub_id primary key
2. sub_name
3. coordinator
4. dept_name

entity hod
1. hod_id primary key
2. name
3. dept_id
Step 4
finalise the design of ER model

Question 7: How deletion, insertion is possible using relational Algebra?

Answer -Deletion
We express a delete request in much the same way as a quary. Instead of displaying the tuples to user we
remove the selected toples from the database . we can delete only two toples. We can delete the only whole
value , we cannot delete the values on particular attribute in relation algebra deletion is represented by
R=R= --- E
Where r is called the relation and E is the relational algebra query let us take example
Delete all the account records of particular employee smith
Depositordepositor −− sigma(customer name) =”smith” (depositor)
Insertion
To insert tha data in the relation we either specify the tuples to be a query who results to set of tuples to be
inserted obviously the attribute value for inserted tuples must be member of attribute domain similarly ,tuple
inserted must be correct arity. The relational algebra represent the insertion as
RR U E where R is the relation and E is the relational algebra expression w. we express the insertion of a
single tuple by letting E be the constant relation congaing one tuple suppose we want to insert the smith has
1200 dollar In account A-937,”perryridge ”branch. We write
Accountaccount U {(A-973”perryidge”,1200)}
Depositor  depositor U{(“smith,a-973”)}

You might also like