You are on page 1of 7

Assignment 1

Q 1: Write the rela-onal Algebra, Tuple R. Calculus, Domain R. Calculus and SQL queries for following
parts:

a) Display the last name and job -tle of all employees who do not have a manager

b) Display the last name, job, and salary for all employees whose job is sales representa-ve or
stock clerk and whose salary is not equal to $2,500

c) find the branch-name, loan-number, and amount for loans of over


$1200

d) Find the names of all customers who have an account at all the branches lo-
cated in Brooklyn

e) List the name of each employee who works onsome project controlled by department num-
ber 5.

Q 2: How does tuple rela-onal calculus differ from domain rela-onal calculus?

Q3. What is the difference between logical data independence and physical data independence?
Which one is harder to achieve? Why?

Q4. Define the following terms: en-ty, aVribute, aVribute value, rela-onship instance, composite
aVribute, mul-valued aVribute, derived aVribute, complex aVribute, key aVribute, and value set
(domain).

Q5. What is an en-ty type? What is an en-ty set? Explain the differences among an en-ty, an en-ty
type, and an en-ty set.

Q6. Consider the ER diagram which shows a simplified schema for an airline reserva-ons system.
Extract from the ER diagram the requirements and constraints that produced this schema. Try to be
as precise as possible in your requirements and constraints specifica-on.

Q7. What is the difference between specializa-on and generaliza-on? Why do we not display this
difference in schema diagrams?

Q8. What are the main similari-es and differences between conceptual database modeling tech-
niques and knowledge representa-on techniques?

Q9. Discuss the en-ty integrity and referen-al integrity constraints. Why is each considered impor-
tant?

Q10. Can we convert weak en-ty set into strong en-ty? If yes, then how? If no, then why?

Q11. Describe the basic features of Hierarchal data model and Discuss their advantages, disadvan-
tages and importance to the end user and the designer.

Q12. Describe the basic features of rela-onal data model and Discuss their advantages, disadvan-
tages and importance to the end user and the designer.
Ques 2. Rela-onal Calculus in non-procedural query language and has no descrip-on about how the
query will work or the data will b fetched. It only focusses on what to do, and not on how to do it.
Rela-onal Calculus exists in two forms Tuple Rela-onal Calculus (TRC) and Domain Rela-onal Calcu-
lus (DRC)

Tuple Rela-onal Calculus (TRC)

A tuple is a single element of a relation. In database terms, it is a


row.

The tuple-oriented calculus uses a tuple variables i.e., variable


whose only permitted values are tuples of that relation. E.g. QUEL

The tuple-oriented calculus uses a tuple variables i.e., variable


whose only permitted values are tuples of that relation.

Domain Rela-onal Calculus (DRC)

The domain-oriented calculus has domain variables i.e., variables


that range over the underlying domains instead of over relation.
E.g. ILL, DEDUCE.

A domain is equivalent to a column data type and any constraints


on the values of that data. For example the !First Name"#of a cus-
tomer field would be character data and might have a restriction
that it not be NULL.

There is a very big conceptual difference between the two.In case


of tuple relational calculus ,you operate on each tuples but in case
of domain relational calculus ,you deal with each column or at-
tribute.Both methods can be used to get any result.

Ques 3. Data independence:-

data independenc can be defined as the capacity to change the


schema at one level of a database system without having to
change the schema at the next higher level .

There are 2 types of data independenc:-

a) Logical data independence.

b) Physical data independence.

a) Logical data independence:-

It is the ability to change the conceptual schema without changing


external or view schema.

Ex: Adding new record to table or column to the table removing a


record or column.

b) Physical data independence:-

It is the ability to change the internal schema without changing the


conceptual schema.

Ex: To improve the performance we may need to change the inter-


nal storage structure or access path.

The basic difference between physical data independence and log-


ical data independence is that the first shields users and ap-
plications from changes at the physical level whereas the latter
shields them from changes at the logical level.

AS applications are heavily dependent on logical structure of data


than physical structure of the data. So it's hard to achieve logical
DI than physical DI.

Ques 4.

Entity – An entity can be a real-world object, either animate or inanimate, that


can be easily identifiable. For example, in a school database, students, teachers,
classes, and courses offered can be considered as entities. All these entities have
some attributes or properties that give them their identity.

Attribute – In general, an attribute is a characteristic. In a database management


system (DBMS), an attribute refers to a database component, such as a table. It
also may refer to a database field. Attributes describe the instances in the row of
a database.

Attribute Value – Attribute value is the real data of a particular entity for each of
its attributes. In other word, associated with each real world entities are certain
attributes that describe that entity; value of these attributes for any entity is
called attribute value. For example, attribute value of first_name of attribute of
student_name can be Gyanendra.

Relationship Instance – Each relationship instance ri in R is an association of


entities, where the association includes exactly one entity from each participat-
ing entity type. Each such relationship instance ri represent the fact that the enti-
ties participating in ri are related in some way in the corresponding miniworld
situation. For example, in relationship type WORKS_FOR associates one EM-
PLOYEE and DEPARTMENT, which associates each employee with the de-
partment for which the employee works. Each relationship instance in the rela-
tionship set WORKS_FOR associates one EMPLOYEE and one DEPART-
MENT.

Composite Attributes – Composite attribute is an attribute that can be divided


into smaller subparts, which represent more basic attributes with dependent
meanings, is called a composite attribute. For example, the Address attribute
consists of several domains such as house number, street number, city, country,
etc.

Multivalued Attribute – A multi-valued attribute can have more than one value
at one time. For example, address of a person is a multi-valued attribute since a
person can have more than one address such as Present and Permanent address.
Upper and lower bounds may be placed on the number of values in a multi-val-
ued attribute. For example, a bank may limit the number of addresses recorded
for a single customer to two.

Derived Attribute - If an attribute!s value can be determined from the values of


other attributes, then the attribute is derivable, and is said to be a derived at-
tribute. Example: consider attributes for an employee: birth date, current age;
here, age is derivable by subtracting the birth date from the current date.

Complex Attribute – Composite and multivalued attribute can be nested arbi-


trarily. Arbitrary nesting can be represented by grouping components of a com-
posite attribute between parenthesis and separating the components with com-
mas and by displaying multivalued attributes between braces. Such attributes
are called composite attributes. For example, if a person has more than one ad-
dress and each residence has multiple phones and address_phone attribute can
be specifies as:
{AddressPhone((Phone{AreaCode,PhoneNumber)},Address(StreetAddress(Nu
mber,Street,ApartmentNumber), City, State, Zip) ) }

Key Attribute – Each real world entity is unique in itself. There are certain at-
tributes whose value is different for all similar type of entities. Those attributes
are called key attributes. These attributes are used to specify uniqueness con-
straint in relation. For example, a house has a registration number. This is a key
of all entity of house.

Value Set(Domain) – There is a range of values from which a particular at-


tribute can take value for a attribute of a real world entity. For example, salary
attribute of an employee must have value, let, from $2000 to $12000, and then
all integers in range $2000 to $12000 are domain of attribute salary.
Ques 5.
A set of entities that have the same attributes is called an entity type.
Each entity type in the database is described by a name and a list of at-
tributes. For example an entity employee is an entity type that has
Name, Age and Salary attributes. The individual entities of a particular
entity type are grouped into a collection or entity set, which is also called
the extension of the entity type. An entity is a thing in the real world. It
may be an object with a physical existence or an object with a conceptu-
al existence. A set of these entities having same attributes is entity type
and collection of individual entity type is an entity set. Entity means Table
Entity Set means Rows in a Table Property means Columns in a Table

Ques 7.

There is just a little bit difference between Generalization and


Specialization.
Generalization is the process of extracting common character-
istics from two or more classes i.e providing you the common
characteristics of different thinks and combining them to one
super-class called generalization.
Specialization is the reverse process of generalization means
introducing some new characteristics and creating the new
class from the super-class. These classes are having charac-
teristics of super-class as well as its own new characteristics.
Let's take a simple example of Color. Color are of many types
that is red, yellow blue etc. So color is the generalization and if I
talk about specific color then that is specialization. Like this ball
is having some color on it (generalization). And if I say this ball
is having red color then it is Specialization

Generalization and specialization both are the designing proce-


dures and both are equally important to design a schema.
Which one to use depends on upon the requirement of a user.

Ques 8.
Major similarities and differences between conceptual database modeling tech-
niques and knowledge representation techniques:
1. Both the disciplines use an abstraction process to identify common properties
and important aspects of objects in the miniworld while suppressing insignif-
icant differences and unimportant details.

2. Both disciplines provide concepts, constraints, operations, and languages for


defining data and representing knowledge.

3. KR is generally broader in scope than semantic data models. Different forms


of knowledge, such as rules, incomplete and default knowledge, temp oral and
spatial knowledge, are represented in KR schemes.

4. KR schemes include reasoning mechanisms that deduce additional facts


stored in a database. Hence, whereas most current database systems are limited
to answering the direct queries, knowledge-based systems using KR schemes
can answer queries that involve inferences over the stored data.

5. Whereas most data models concentrate on the representation of database


schemas, or meta-knowledge, KR schemes often mix up the schemas with the
instances themselves in order to provide flexibility in representing exceptions.
This often leads to inefficiencies when KR schemes are implemented in com-
parison to database especially when large amount of data needs to be stored.

Ques 9.
Ques 10.
Ques 11.

Ques 12.

• It is built with unique tables


• Each table represents one entity
• every table must have a primary key
• the link between the primary and foreign key must exist
• the first order predicate logic is based on data modelling

It consists of a structured querying language with a well-defined model.The


database ensure that every table should at least have one entity to query a logic.
Only when there is a proper relation between the entities and have and the de-
sired output is met, an error may show up or irrelevant values may be generated.
As a security purpose, every table must have a primary key in which table can
be identified and classified based on the primary keys. These procedures are
very helpful for designers since it provides information in structured model
which designer can use to develop the system accordingly this makes the work
is your accurate for end-users. The end user might not have a major impact over
this, but for the designers the work gets easier since they determine the flow in a
model format .They will be assigned with all the relations between entity and all
the necessary keys and the only step that needs to be taken is by ensuring that
the implementation details are hidden within the system and the end users can-
not view or edit the implementation

You might also like