Professional Documents
Culture Documents
Dbms Vimp Micro
Dbms Vimp Micro
Explain the 2 NF
Normalization is the process of organizing the data in the database.
Normalization is used to minimize the redundancy from a relation or set of relations. It is
also Used to eliminate undesirable characteristics like Insertion, Update, and Deletion
Anomalies.
First normal form Does not eliminate redundancy. but rather it's that's it elements
repeating groups.Instead of multiple columns of the same kind of data in a record you
would remove the repeated information into separate relationships and represent them
as rows. this is what consists 1NF
The second normal form is based on the concept of full functional dependency., the 2NF
normal form applies to relation with composite keys, that is relation with a primary key
composed of two or more attributes.A relation with a single attribute primary key is
automatically in at least 2NF.
A relation that Is not in 2NF May suffer from the update anomalies. To be in second form
a relation must be first normal form and relation must not contain any partial
dependency that is no non prime attribute is dependent on any proper subset of any
candidate key of the table.The normalizationnormalizationof 1NF RELATIONS 2NF Inwald
the removal or partial dependencies. If a partial dependency exists we remove the
partially dependent attribute from the relation by placing consider the example given
below.
A relation is in 1NF if it contains atomic values. It states that an attribute of a table cannot
hold multiple
values. It must hold only single-values attributes. First normal form disallows the multi-
valued attributes,
composite attributes, and their combinations.
Domains – All the possible allowable values for an attribute. This is slightly different to
the data type of the attribute. For example, a field may have an integer number data
type, which defines that it can only allow whole numbers to be entered. However, there
may be additional rules applied,such as that the number must be between 1 & 10. The
domain would therefore be this range of whole numbers. Cardinality – How unique an
attribute is in terms of its data values. Some attributes will have a wide range of different
data values entered. For example, the primary key field will have a completely unique
value for every record. Where there is a large percentage of unique values, this is known
as “High Cardinality”. Where there are a lot of repeated values across the entities tuples,
this is known as having “Low Cardinality
4
Explain in detail types of anomaly?
Ans.
Normalization is the process of splitting relations into well-structured relations that allow
users To insert, delete, and update tuples without introducing database inconsistencies.
Without Normalization, many problems can occur when trying to load an integrated
conceptual model into the DBMS. These problems arise from relations that are generated
directly from user views are called Anomalies. There are three types of anomalies: update,
deletion, and insertion anomalies.
1)Update Anomaly-An update anomaly is a data inconsistency that results from data
redundancy and a Partial update. For example, each employee in a company has a
department associated with them as Well as the student group they participate in
2- Insertion Anomaly: Let’s say we have a table that has 4 columns. Student ID, Student
Name, Student Address and Student Grades. Now when a new student enroll in school,
Even though first three attributes can be filled but 4th attribute will have NULL value
Because he doesn’t have any marks yet.
3. Multivalued Attribute – An attribute consisting more than one value for a given entity.
For example, Phone_No (can be more than one for a given student). In ER diagram,
multivalued attribute is Represented by double oval.
4. Derived Attribute –
An attribute which can be derived from other attributes of the entity type is known as
derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, derived attribute
is represented by dashed oval.
6
Explain Extended E-R features?
Take an example – a person (name, street, city) be an entity set which is further classified
1)Specialization –
The process of designating to sub grouping within an entity set is Called specialization. In
above figure, the “person” is distinguish in to whether they are“employee” or
“customer”.
Formally in above figure specialization is depicted by a triangle component labelled (is
2)Generalization –
generalization is relationship that exist between higher level entity set And one or more
lower level entity sets. Generalization synthesizes these entity sets into Single entity set
Example: Let’s assume there is a company where employees work in more than one
department.
EMP_ID → EMP_COUNTRY
The table is not in BCNF because neither EMP_DEPT nor EMP_ID alone are keys.
To convert the given table into BCNF, we decompose it into three tables:
Functional dependencies:
EMP_ID → EMP_COUNTRY
Candidate keys:
For the first table: EMP_ID
For the first table: EMP_DEPT
For the first table: {EMP_ID, EMP_DEPT}
Now, this is in BCNF because left side part of both the functional dependencies is a key.
8
2NF: We saw candidate key above and here is where it plays a role. 2NF rule signifies that
No non-prime attributes in the table are dependent on any of the candidate key. In
simple Words, If the table is representative of two different entities then it should be
broken down Into their own entities. For example: If we have a table (Student ID, Student
Name, Course Number, Course Name, Teacher ID, Teacher Name) this is representing
information about Each student enrolled in each course which is taught by each teacher
in school. Since it is A representative of three different entities it must be normalized into
2NF form.
3NF: This rule signifies that tables must be in 2NF form and each table should only contain
Columns that are non-transitively depended on primary key of their own table. In simple
Words, if we have a table (Transaction ID, price, quantity, total_sales) here the total sales
Is the product of price and quantity (price*quantity). Hence sales is transitively depended
In Transaction ID which is a primary key here. So each attribute must directly depend
upon The primary key.
BCNF Normal Form
Boyce Codd normal form (BCNF)
BCNF is the advance version of 3NF. It is stricter than 3NF.
11
What is Functional Dependency? It’s types
Functional Dependency (FD) is a constraint that determines the relation of one attribute
to another Attribute in a Database Management System (DBMS). Functional Dependency
helps to maintain the Quality of data in the database. It plays a vital role to find the
difference between good and bad Database design.A functional dependency is denoted
by an arrow “→”. The functional dependency of X on Y is Represented by X → Y.
There are mainly four types of Functional Dependency in DBMS. Following are the types
of Functional Dependencies in DBMS:
1.Multivalued Dependency in DBMS → Multivalued dependency occurs in the situation
where there are multiple independent multivalued attributes in a single.
Car_model. Maf_ year. Color
H001. 2017. Green
H001. 2018. Red
2.Trivial Functional Dependency in DBMS
The Trivial dependency is a set of attributes which are called a trivial if the set of
attributes are included In that attribute.So, X -> Y is a trivial functional dependency if Y is
a subset of X. Let’s understand with a Trivial Functional Dependency Example.
Emp_id. Emp_name
AS555. Harry
AS811 George
AS999 Kevin
i
FD set:
{STUD_NO -> STUD_NAME, STUD_NO -> STUD_STATE, STUD_STATE ->
STUD_COUNTRY, STUD_NO -> STUD_AGE}
Candidate Key:
{STUD_NO}
STUD_NO -> STUD_STATE and STUD_STATE -> STUD_COUNTRY are
true. So STUD_COUNTRY is transitively dependent on STUD_NO. It
violates the third normal form. To convert it in third normal form, we
will decompose the relation STUDENT (STUD_NO, STUD_NAME,
STUD_PHONE, STUD_STATE, STUD_COUNTRY_STUD_AGE)
13
Explain user of DBMS ?
Database users are categorized based up on their interaction with the data base.
These are seven types of data base users in DBMS.
1.Database Administrator (DBA) :
Database Administrator (DBA) is a person/team who defines the schema and also
controls the 3 levels of database.The DBA will then create a new account id and password
for the user if he/she need to access the data base.
DBA also monitors the recovery and back up and provide technicalsupport.
The DBA has a DBA account in the DBMS which called a system or superuser account.
DBA repairs damage caused due to hardware and/or software failures.
2.Naive / Parametric End Users :
Parametric End Users are the unsophisticated who don’t have any DBMS knowledge but
they frequently use the data base applications in their daily life to get the desired results.
3. System Analyst:
System Analyst is a user who analyzes the requirements of parametric end users. They
check whether all the requirements of end users are satisfied.
4. Sophisticated Users :
Sophisticated users can be engineers, scientists, business analyst, who are familiarWith
the database. They can develop their own database applications according to
their requirement. They don’t write the program code but they interact the data base
by writing SQL queries directly through the query processor.
5. Data Base Designers :Data Base Designers are the users who design the structure of
data base which includes tables, indexes, views, constraints, triggers, stored procedures.
He/she controls what data must be stored and how the data items to be related.
6. Application Program :Application Program are the back end programmers who writes
the code for the application programs. Programming languages such as Visual Basic,
Developer, C, FORTRAN, COBOL etc.
7.Casual Users / Temporary Users :Casual Users are the users who occasionally
use/access the data base but each time when they access the data base they require the
new information, for example, Middle or higher level manager.
14
Components of ER model
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the
relationship With other entity is called weak entity
2.Attribute
1. Key attribute
2.Composite attribute
3. Multivalued attribute
4. Derived attribute
1-A key attribute can uniquely identify an entity from an entity set. For example, student
roll Number can uniquely identify a student from a set of students.
2- An attribute that is a combination of other attributes is known as composite attribute.
For example, In student entity, the student address is a composite attribute as an address
is composed of other attributes such as pin code, state, country.
3-An attribute that can hold multiple values is known as multivalued attribute. It is
represented with Double ovals in an ER Diagram.
4- A derived attribute is one whose value is dynamic and derived from another attribute.
It is represented by dashed oval in an ER Diagram.
3. Relationship
A relationship is represented by diamond shape in ER diagram, it shows the relationship
among entities. There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
17
Explain ER Diagram
An ER diagram shows the relationship among entity sets. An entity
set is a group of similar entities and these entities can have
attributes. In terms of DBMS, an entity is a table or attribute of a
table in database, so by showing relationship among tables and their
attributes, ER diagram shows the complete logical structure of a
database. Lets have a look at a simple ER diagram to understand
this concept.
A simple ER Diagram:
In the following diagram we have two entities Student and College
and their relationship. The relationship between Student and College
is many to one as a college can have many students however a
student cannot study in multiple colleges at the same time. Student
entity has attributes such as Stu_Id, Stu_Name & Stu_Addr and College
entity has attributes such as
Explain Cardinality
Databases have a lot of jargon, and cardinality is one of those words that experienced
people Tend to forget that they didn’t know once upon a time. But if
you don’t know it—and it takes a While to really get comfortable
with cardinality—it’s super confusing when the DBA just drops it
Into the middle of a sentence without slowing down! Fear not: I’ve
got you, as they say.
Cardinality means two things in databases. For our purposes, one
matters a lot more than the Other. Let’s do the simple one first, and
then dig into the one that matters for query performance. The
definition of cardinality that matters a lot for query performance is
data cardinality. This is
All about how many distinct values are in a column.The first meaning
of cardinality is when you’re Designing the database—what’s called
data modeling. In this sense, cardinality means whether a
Relationship is one-to-one, many-to-one, or many-to-many. So you’re
really talking about The relationship cardinality. Cardinality’s official,
non-database dictionary definition is Mathematical.
19
Explain Aggregation
Aggregation –
An ER diagram is not capable of representing relationship between an
entity and a relationship which may be required in some scenarios. In
those cases, a relationship with its corresponding entities is
aggregated into a higher level entity. Aggregation is an abstraction
through which we can represent relationships as higher level entity
sets.
For Example, Employee working for a project may require some
machinery. So, REQUIRE relationship is needed between relationship
WORKS_FOR and entity MACHINERY. Using aggregation, WORKS_FOR
relationship with its entities EMPLOYEE and PROJECT is aggregated
into single entity and relationship REQUIRE is created between
aggregated entity and MACHINERY.
20