0% found this document useful (0 votes)
7 views

dbmsunit2 (1)

Uploaded by

Mohammad Aabid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

dbmsunit2 (1)

Uploaded by

Mohammad Aabid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

DBMS UNIT – II

1.Compare generalization, specialization and aggregation with suitable examples.


2.What is ER model ? What are the elements of ER model ? OR What are the notations
of ER diagram ?
An entity relationship model (ER model) is a way of representing the entities and the relationships between the entities
in order to create a database.
1. Entity :
a. An entity is a real world object that can be easily identifiable.
b. An entity can be abstract or concrete.
c. An entity is an object that exists and is distinguishable from other objects.
d. Entity can be converted into table.
e. Entity have a primary key.
2. Entity set :
a. Entity set is a collection of similar type of entities.
b. An entity set may contain entities with attribute sharing similar values.
3. Attribute :
a. An attribute gives the characteristics of the entity.
b. It is also called as data element, data field, a field, a data item, or an elementary item.

4. Relationship : a. A relationship is the association between entities or entity occurrence.


b. Relationship is represented by diamond with straight lines connecting the entities.
3.What do you understand by attributes and domain ? Explain various types of attributes used in conceptual
data model.
Attributes:
1. Attributes are properties which are used to represent the entities.
2. All attributes have values. For example, a student entity may have name, class, and age as attributes.
3. There exists a domain or range of values that can be assigned to attributes.
4. For example, a student’s name cannot be a numeric value. It has to be alphabetic. A student’s age cannot be
negative, etc.
Domain:
1. A domain is an attribute constraint which determines the type of data values that are permitted for that attribute.
2. Attribute domains can be very large, or very short.
Types of attributes used in conceptual data model :
1.Simple attribute : Simple attributes are atomic values, which cannot be divided further. For example, a student’s
phone number is an atomic value of 10 digits.
2. Composite attribute : Composite attributes are made of more than one simple attribute. For example, a student's
complete name may have first_name and last_name.
3. Derived attribute : Derived attributes are the attributes that do not exist in the physical database, but their values
are derived from other attributes present in the database. For example, average_salary in a department should not be
saved directly in the database, instead it can be derived.
4. Single-value attribute : Single-value attributes contain single value. For example, Social_Security_Number.
5. Multi-value attribute : Multi-value attributes may contain more than one values. For example, a person can have
more than one phone number, email_address, etc.
4.What is purpose of the ER diagram ? Construct an ER diagram for a University system which should include
information about students, departments, professors, courses, which students are enrolled in which course,
which professors are teaching which courses, student grades, which course a department offers.
Purpose of the ER diagram :
1. ER diagram is used to represent the overall logical structure of the database.
2. ER diagrams emphasis on the schema of the database and not on the instances because the schema of the database
is changed rarely.
3. It is useful to communicate the logical structure of database to end users.
4. It serves as a documentation tool.
5. It helps the database designer in understanding the information to be contained in the database.
ER diagram :

5.Describe mapping constraints with its types. OR Describe mapping constraints with its types.
1. Mapping constraints act as a rule followed by contents of database.
2. Data in the database must follow the constraints.
Types of mapping constraints are :
1. Mapping cardinalities :
a. Mapping cardinalities (or cardinality ratios) specifies the number of entities of which another entity can be
associated via a relationship set.
b. Mapping cardinalities are used in describing binary relationship sets, although they contribute to the description of
relationship sets that involve more than two entity sets.
c. For binary relationship set R between entity sets A and B, the mapping cardinality must be one of the following :
i. One to one : An entity in A is associated with at most one entity in B and an entity in B is associated with at most
one entity in A.

ii. One to many : An entity in A is associated with any number of entities in B. An entity in B, however, can be
associated with at most one entity in A.

iii. Many to one : An entity in A is associated with at most one entity in B, and an entity in B, however, can be
associated with any number of entities in A.
iv. Many to many : An entity in A is associated with any number of entities in B, and an entity in B is associated with
any number of entities in A.

2. Participation constraints :
It tells the participation of entity sets. The participation constraints specify whether the existance of an entity depends
on its being related to another entity via the relationship type.
There are two types of participations :
i. Partial participation
ii. Total participation

6. Define key. Explain various types of keys.


1. Key is a attribute or set of attributes that is used to identify data in
entity sets.
2. Key is defined for unique identification of rows in table.
Consider the following example of an Employee table :
Employee (EmployeeID, FullName, SSN, DeptID)
Various types of keys are :

1. Primary key :
a. Primary key uniquely identifies each record in a table and must never, be the same for records. Here in Employee
table we can choose either EmployeeID or SSN columns as a primary key.
b. Primary key is a candidate key that is used for unique identification of entities within the table.
c. Primary key cannot be null.
d. Any table has a unique primary key.
2. Super key :
a. A super key for an entity is a set of one or more attribute whose combined value uniquely identifies the entity in the
entity set.
b. For example : Here in employee table (EmployeeID, FullName) or
(EmployeeID, FullName, DeptID) is a super key.
3. Candidate key :
a. A candidate key is a column, or set of column, in the table that can uniquely identify any database record without
referring to any other data.
b. Candidate key are individual columns in a table that qualifies for uniqueness of all the rows. Here in Employee
table EmployeeID and SSN are candidate keys.
c. Minimal super keys are called candidate keys.
4. Composite key :
a. A composite key is a combination of two or more columns in a table that can be used to uniquely identify each row
in the table.
b. It is used when we cannot identify a record using single attributes.
c. A primary key that is made by the combination of more than one attribute is known as a composite key.
5. Alternate key :
a. The alternate key of any table are those candidate keys which are not currently selected as the primary key.
b. Exactly one of those candidate keys is chosen as the primary key and the remainders, if any are then called alternate
keys.
c. An alternate key is a function of all candidate keys minus the primary key. d. Here in Employee table if
EmployeeID is primary key then SSN would be the alternate key.
6. Foreign key :
a. Foreign key represents the relationship between tables and ensures the referential integrity rule.
b. A foreign key is derived from the primary key of the same or some other table.
c. Foreign key is the combination of one or more columns in a table (parent table) at references a primary key in
another table (child table).
d. A foreign key value can be left null. For example : Consider another table : Project (ProjectName, TimeDuration,
EmployeeID)
a. Here, the ‘EmployeeID’ in the ‘Project’ table points to the ‘EmployeeID’ in ‘Employee’ table
b. The ‘EmployeeID’ in the ‘Employee’ table is the primary key.
c. The ‘EmployeeID’ in the ‘Project’ table is a foreign key.
7. What do you mean by a key to the relation ? Explain the differences between super key, candidate key and

primary key.
8. Discuss extended or enhanced ER model (EERM).
1. The ER model that is supported with the additional semantic concepts is called the extended entity relationship
model or EER model.
2. The EER model includes all the concepts of the original ER model together with the following additional concepts
a. Specialization : explain in detail
b. Generalization : explain in detail
c. Aggregation : explain in detail
3. The super class/subclass entity types (or super type /subtype entities) is one of the most important modelling
constructs that is included in the EER model.
4. This feature enables us to model a general entity and then subdivide it into several specialized entity types
(subclasses or subtypes).
5. EER diagrams are used to capture business rules such as constraints in the super type/subtype relations. Thus, a
super class is an entity type that includes distinct subclasses that require to be represented in a data model.
6. A subclass is an entity type that has a distinct role and is also a member of a super class.

9 .Explain the reduction of ER schema to tables. OR How to reduce an ER model into table ?
1. In ER model, database are represented using the different notations or diagrams, and these notations can be reduced
to a collection of tables.
2. In the database, every entity set or relationship set can be represented in tabular form.
Consider following ER diagram :
Basic rules for converting the ER diagrams into tables are :
1. Convert all the entities in the diagram to tables :
a. All the entities represented in the rectangular box in the ER diagram become independent tables in the database. b.
In the ER diagram, Student, Course, Lecturer and Subjects forms individual tables.
2. All single-valued attribute becomes a column for the table :
a. All the attributes, whose value at any instance of time is unique, are considered as columns of that table.
b. In the Student entity, Student_Name and Student_ID form the column of Student table. Similarly, Course_Name
and Course_ID form the column of Course table and so on.
3. A key attribute of the entity is the primary key :
a. All the attributes represented in the oval shape and underlined in the ER diagram are considered as key attribute
which act as a primary key of table.
b. In the given ER diagram, Student_ID , Course_ID, Subject_ID, and Lecture_ID are the key attribute of the Student,
Course, Subjects and Lecturer entity.
4. The multivalued attribute is represented by a separate table :
a. In the student table, a hobby is a multivalued attribute.
b. So it is not possible to represent multiple values in a single column of Student table. Hence we create a table
Stud_Hobby with column name Student_ID and Hobby. Using both the column, we create a composite key.
5. Composite attributes are merged into same table as different columns :
a. In the given ER diagram, student address is a composite attribute. It contains City, Pin, Door_No, Street, and State.
b. In the Student table, these attributes can merge as an individual column.
6. Derived attributes are not considered in the table :
a. In the Student table, Age is the derived attribute.
b. It can be calculated at any point of time by calculating the difference between current date and Date of Birth (DoB).

10. What is strong and weak entity set ?


Strong entity : Strong entity is not dependent of any other entity in schema. Strong entity always has primary key.
Strong entity is represented by single rectangle. Two strong entity’s relationship is represented by single diamond.
Weak entity : Weak entity is dependent on strong entity to ensure the existence of weak entity. Weak entity does not
have any primary key, it has partial discriminator key. Weak entity is represented by double rectangle.
For a weak entity set to be a meaningful, it must be associated with another entity set, called the identifying or owner
entity set. Every weak entity must be associated with an identifying entity; that is, the weak entity set is said to be
existence dependent on the identifying entity set. The identifying entity set is said to own the weak entity set that it
identifies. The relationship associating the weak entity set with the identifying entity set is called the identifying
relationship.
11. Define the term degree and cardinality.
Degree : The number of attributes in a relation is known as degree.
Cardinality : The number of tuples in a relation is known as cardinality.

You might also like