SlideShare a Scribd company logo
1 of 25
Download to read offline
Assistant Professor (GAJENDRA JINAGR) 1
BCA EXAMINATION 2016
DBMS
Q.1 a)List Out Four Significance Difference Between A File Processing System And
DBMS?
Ans:
File Processing System Database Management System
On the other hand, a file system is a more
unstructured data store for storing arbitrary,
probably unrelated data.
A database is generally used for storing related,
structured data, with well defined data formats, in an
efficient manner for insert, update and/or retrieval.
A file system provides much looser guarantees
about consistency, isolation and durability.
While databases are consistent at any instant in
time,provide,isolated transactions and durable writes,
A file-processing system coordinates only the
physical access to the data.
A database management system coordinates both the
physical and the logical access to the data
A file-processing system is designed to allow
predetermined access to data (i.e. compiled
programs)
A database management system is designed to allow
flexible access to data (i.e. queries)
Unauthorized access cannot be restricted in
DBMS
Unauthorized access is restricted in DBMS
Redundancy cannot be controlled in File
processing system.
Redundancy can be controlled in File processing
system.
Q.1 State and Explain the advantages and disadvantages of DBMS?
Ans: Advantages of Database Management System (DBMS)
1. Improved data sharing
An advantage of the database management approach is, the DBMS helps to create an
environment in which end users have better access to more and better-managed data.
Such access makes it possible for end users to respond quickly to changes in their environment.
2. Improved data security
The more users access the data, the greater the risks of data security breaches. Corporations
invest considerable amounts of time, effort, and money to ensure that corporate data are used
properly. A DBMS provides a framework for better enforcement of data privacy and security
policies.
3. Better data integration
Wider access to well-managed data promotes an integrated view of the organization’s
operations and a clearer view of the big picture. It becomes much easier to see how actions in
one segment of the company affect other segments.
Assistant Professor (GAJENDRA JINAGR) 2
4. Minimized data inconsistency
Data inconsistency exists when different versions of the same data appear in different
places. For example, data inconsistency exists when a company’s sales department stores a sales
representative’s name as “Bill Brown” and the company’s personnel department stores that same
person’s name as “William G. Brown,” or when the company’s regional sales office shows the
price of a product as $45.95 and its national sales office shows the same product’s price as
$43.95. The probability of data inconsistency is greatly reduced in a properly designed database.
5. Improved data access
The DBMS makes it possible to produce quick answers to ad hoc queries. From a
database perspective, a query is a specific request issued to the DBMS for data manipulation—for
example, to read or update the data. Simply put, a query is a question, and an ad hoc query is a
spur-of-the-moment question. The DBMS sends back an answer (called the query result set) to
the application. For example, end users, when dealing with large amounts of sales data, might
want quick answers to questions (ad hoc queries) such as:
- What was the dollar volume of sales by product during the past six months?
- What is the sales bonus figure for each of our salespeople during the past three months?
- How many of our customers have credit balances of 3,000 or more?
6. Improved decision making
Better-managed data and improved data access make it possible to generate better-
quality information, on which better decisions are based. The quality of the information
generated depends on the quality of the underlying data. Data quality is a comprehensive
approach to promoting the accuracy, validity, and timeliness of the data. While the DBMS does
not guarantee data quality, it provides a framework to facilitate data quality initiatives.
7. Increased end-user productivity
The availability of data, combined with the tools that transform data into usable
information, empowers end users to make quick, informed decisions that can make the
difference between success and failure in the global economy.
Till now we have seen different benefits of database management systems. But it has certain
limitations or disadvantages.
Let's find various disadvantages of database system.
Disadvantages of Database Management System (DBMS):
Although the database system yields considerable advantages over previous data management
approaches, database systems do carry significant disadvantages. For example:
1. Increased costs
one of the disadvantages of dbms is Database systems require sophisticated hardware and
software and highly skilled personnel. The cost of maintaining the hardware, software, and
personnel required to operate and manage a database system can be substantial. Training,
licensing, and regulation compliance costs are often overlooked when database systems are
implemented.
2. Management complexity
Database systems interface with many different technologies and have a significant impact
on a company’s resources and culture. The changes introduced by the adoption of a database
Assistant Professor (GAJENDRA JINAGR) 3
system must be properly managed to ensure that they help advance the company’s objectives.
Given the fact that database systems hold crucial company data that are accessed from multiple
sources, security issues must be assessed constantly.
3. Maintaining currency
To maximize the efficiency of the database system, you must keep your system current.
Therefore, you must perform frequent updates and apply the latest patches and security
measures to all components.
Because database technology advances rapidly, personnel training costs tend to be significant.
Vendor dependence. Given the heavy investment in technology and personnel training,
companies might be reluctant to change database vendors.
As a consequence, vendors are less likely to offer pricing point advantages to existing customers,
and those customers might be limited in their choice of database system components.
4. Frequent upgrade/replacement cycles
DBMS vendors frequently upgrade their products by adding new functionality. Such new
features often come bundled in new upgrade versions of the software. Some of these versions
require hardware upgrades. Not only do the upgrades themselves cost money, but it also costs
money to train database users and administrators to properly use and manage the new features.
***********************************
Q.2 Define and explain different levels of Data Abstraction?
Ans: Database systems are made-up of complex data structures. To ease the user interaction
with database, the developers hide internal irrelevant details from users. This process of hiding
irrelevant details from user is called data abstraction.
We have three levels of abstraction:
Physical level: This is the lowest level of data abstraction. It describes how data is actually stored
in database. You can get the complex data structure details at this level.
Logical level: This is the middle level of 3-level data abstraction architecture. It describes what
data is stored in database.
View level: Highest level of data abstraction. This level describes the user interaction with
database system.
Assistant Professor (GAJENDRA JINAGR) 4
1. Physical Level:
o How the data are stored.
o E.g. index, B-tree, hashing.
o Lowest level of abstraction.
o Complex low-level structures described in detail.
2. Conceptual Level:
o Next highest level of abstraction.
o Describes what data are stored.
o Describes the relationships among data.
o Database administrator level.
3. View Level:
o Highest level.
o Describes part of the database for a particular group of users.
o Can be many different views of a database.
o E.g. tellers in a bank get a view of customer accounts, but not of payroll data.
Example: Let’s say we are storing customer information in a customer table.
At physical level these records can be described as blocks of storage (bytes, gigabytes, terabytes
etc.) in memory. These details are often hidden from the programmers.
At the logical level these records can be described as fields and attributes along with their data
types, their relationship among each other can be logically implemented. The programmers
generally work at this level because they are aware of such things about database systems.
At view level, user just interact with system with the help of GUI and enter the details at the
screen, they are not aware of how the data is stored and what data is stored; such details are
hidden from them.
Q.2 What is data model and explain E-R data model with suitable example?
Ans: A database model shows the logical structure of a database, including the relationships and
constraints that determine how data can be stored and accessed. Individual database models are
designed based on the rules and concepts of whichever broader data model the designers adopt.
Most data models can be represented by an accompanying database diagram.
Types of database models There are many kinds of data models. Some of the most common ones
include:
 Hierarchical database model
 Relational model
 Network model
 Object-oriented database model
 Entity-relationship model
Assistant Professor (GAJENDRA JINAGR) 5
Entity-relationship model
This model captures the relationships between real-world entities much like the network model,
but it isn’t as directly tied to the physical structure of the database. Instead, it’s often used for
designing a database conceptually.
Here, the people, places, and things about which data points are stored are referred to as
entities, each of which has certain attributes that together make up their domain. The cardinality,
or relationships between entities, are mapped as well. In a logical sense, entities are the
equivalent of grammatical nouns, such as employees, departments, products, or networks.
An entity can be defined by means of its properties, called attributes. Relationships are the
equivalent of verbs or associations, such as the act of purchasing, the act of repairing, being a
member of a group, or being a supervisor of a department. A relationship can be defined
according to the number of entities associated with it, known as the degree.
the ER model is considered a good option for designing databases.
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.
An entity set is a collection of similar types of entities. An entity set may contain entities with
attribute sharing similar values. For example, a Students set may contain all the students of a
school; likewise a Teachers set may contain all the teachers of a school from all faculties. Entity
sets need not be disjoint.
Attributes
Entities are represented by means of their properties, called attributes. All attributes have
values. For example, a student entity may have name, class, and age as attributes.
There exists a domain or range of values that can be assigned to attributes. For example, a
student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be
negative, etc.
Relationship
The association among entities is called a relationship. For example, an employee works_at a
department, a student enrolls in a course. Here, Works_at and Enrolls are called relationships.
Relationship Set
A set of relationships of similar type is called a relationship set. Like entities, a relationship too
can have attributes. These attributes are called descriptive attributes.
Assistant Professor (GAJENDRA JINAGR) 6
Degree of Relationship
The number of participating entities in a relationship defines the degree of the relationship.
 Binary = degree 2
 Ternary = degree 3
 n-ary = degree
The number of participating entities in a relationship defines the degree of the relationship.
 Binary = degree 2
 Ternary = degree 3
 n-ary = degree
****************************
Q.3 Define with suitable example?
Ans:
(I) Super Key – An attribute or a combination of attribute that is used to identify the records
uniquely is known as Super Key. A table can have many Super Keys.
E.g. of Super Key
1 ID
2 ID, Name
3 ID, Address
4 ID, Department_ID
5 ID, Salary
6 Name, Address
7 Name, Address, Department_ID ………… So on as any combination which can identify the
records uniquely will be a Super Key.
Assistant Professor (GAJENDRA JINAGR) 7
(II) Candidate Key – It can be defined as minimal Super Key or irreducible Super Key. In other
words an attribute or a combination of attribute that identifies the record uniquely but none of
its proper subsets can identify the records uniquely.
E.g. of Candidate Key
1 Code
2 Name, Address
For above table we have only two Candidate Keys (i.e. Irreducible Super Key) used to identify the
records from the table uniquely. Code Key can identify the record uniquely and similarly
combination of Name and Address can identify the record uniquely, but neither Name nor
Address can be used to identify the records uniquely as it might be possible that we have two
employees with similar name or two employees from the same house.
(III) Primary Key – A Candidate Key that is used by the database designer for unique identification
of each row in a table is known as Primary Key. A Primary Key can consist of one or more
attributes of a table.
E.g. of Primary Key - Database designer can use one of the Candidate Key as a Primary Key. In this
case we have “Code” and “Name, Address” as Candidate Key, we will consider “Code” Key as a
Primary Key as the other key is the combination of more than one attribute.
(IV) Foreign Key – A foreign key is an attribute or combination of attribute in one base table that
points to the candidate key (generally it is the primary key) of another table. The purpose of the
foreign key is to ensure referential integrity of the data i.e. only values that are supposed to
appear in the database are permitted.
E.g. of Foreign Key – Let consider we have another table i.e. Department Table with Attributes
“Department_ID”, “Department_Name”, “Manager_ID”, ”Location_ID” with Department_ID as an
Primary Key. Now the Department_ID attribute of Employee Table (dependent or child table) can
be defined as the Foreign Key as it can reference to the Department_ID attribute of the
Departments table (the referenced or parent table), a Foreign Key value must match an existing
value in the parent table or be NULL.
***************************
Q.4 a)Write difference between Tuples relational and Domain relational calculus?
Ans: Tuple Oriented Relational Calculus
The basic construct of tuple calculus is a tuple
calculus expression. Tuple Calculus
expressions are made up of following
constructs or elements.




Assistant Professor (GAJENDRA JINAGR) 8
 TupleVariable:
A tuple variable is a variable that ‘ ranges over’ some named relation i.e. a variable whose only
permitted values are tuple of that relation. Tuple variables are denoted by uppercase letters. For
example T, U, V etc. If the tuple variable T represents tuple t (at given time), then the expression T.
A represents the A component of t( at that time), where A is an attribute of the relation over which
T Ranges.
 Conditions :
Conditions are of the form x * y, where * is any relational operator =, !=, <, <=, >, >= and at least
one of the x & y is an expression of the form T.A & other is either a similar expression or a
constant.
 Well Formed Formulas (WFFs) :
A WFF is constructed from conditions, Boolean operators ( AND, OR, NOT) and quantifiers (∃, ∀)
according to the following rules:
o Every condition is WFF.
o If f is a WFFs, then (f) and NOT(f) are also WFFs.
o If f and G are WFFs, then (f AND g) and (f oOR g) are also WFFs.
o If f is WFF in which T occurs as a free variable then ∃T(f) are WFFs.
o Nothing else is a WFF.
 Criteria for free and bound variables :
o Within the condition all tuple variable occurrences are free.
o Tuple variable occurrence in the WFFs(f), NOT(f) are free/bound according as they are
free/bound in f.
o Tuple variable occurrences in the WFFs(f AND g), (f OR g) are free/bound according as
they are free/bound in f or g.
o Occurrence of T that are free in f are bound in the WFFs ∃T(f), ∀ T(f). Other tuple variable
occurrence in f are free/bound in these WFFs as they are free/bound in f.
Domain Oriented Relational Calculus
The domain oriented relational calculus differs from the tuples calculus in that its variable ranges over
domain rather than relations.
Expressions of the domain calculus are constructed from the following elements.
 Domain Variables :
Domain variables are denoted by uppercase letters. For example D,E,F etc. Each domain variable
is constrained to range over some specified domain.
 Conditions :
Conditions can takes two forms :
1. Simply comparisons :
Form is x * y, same as for the tuple calculus, except that x and y are now the domain
variables ( or constants).
2. Membership Condition :
The form is R (term, term, …..). Here R is a relation and each “term” is a pair A : V, where A
is an attribute of R and V is either a domain variable or a constant.
Assistant Professor (GAJENDRA JINAGR) 9
 Well Formed Formulas (WFFs):
Same as tuple calculus section but with revised definition of condition
 Free and Bound Variables :
Same as tuple calculus.
 Domain Calculus Expressions :
A domain calculus expression is then an expression of the form D, E, ….., F *WHERE f+ where D, E,
….., F are domain variables and f is a WFF containing exactly D, E, ….., F are free variables. The
values of this expression is that subset of the cartesian product D x E x …. x F (where D, E, ….., F
range over all their possible values) for which f evaluated to true – or if “WHERE f” is omitted that
entire cartesian product.
Q..4 B) Define the operation Given Below?
Ans:
1.Projection: The ·projection operation on a table simply forms another table by copying specified
columns (both header and body parts) from the original table, eliminating any duplicated rows. The
projection operator yields a vertical subset of a given relation - that is, that subset obtained by selecting
specified attributes, in a specified left to right order, and then eliminating duplicate tuples within the
attributes selected. Projection is denoted by the Greek letter pi(TI).
For example, consider the table EMPLOYEE, as shown:
The projections of the 'age', the 'age and salary' and the 'personnel_number and name' columns would
return the three tables, say, A, B and C respectively:
2. UNION: n mathematical set theory, the union of two sets is the set of all elements belonging
to both sets. The set, which results from the union, must not, of course, contain duplicate
elements. It is denoted by U. Thus the union of sets:
Sl = {1, 2, 3, 4, 5}
and
Assistant Professor (GAJENDRA JINAGR) 10
S2= {4,5,6,7,8}
would be the set {l, 2,3,4,5,6,7,8}.
A union operation on two relational tables follows the same basic principle but is more complex
in practice. In order to perform the Union operation, both operand relations must be union-
compatible i.e. they must have same number of columns drawn from the same domain (means
must be of same data type).
Suppose that two tables, R and the S have the following tuples at some instant in time, and that
their header parts are as shown below:
These can certainly be combined in to one table containing a valid relation by the relational union
operator ( R US) as follows:
3.INTERSECTION: In mathematics an intersection of two sets produces a set, which contains .
all the elements those are common to both sets. It is denoted by n., Thus the intersection of the
two sets: Sl = { 1,2,3,4,5}
and
S2= {4,5,6,7,8}
would be {4,5}.
In above example, both the tables are union compatible and it can be intersected together. The
intersection operation on the R and Stables (R n S) defined above would return:
The intersection operator is used in a similar fashion to the union operation, but provides an 'and'
function.
Assistant Professor (GAJENDRA JINAGR) 11
4.SELECTION: The selection operator yields a 'horizontal subset of a given relation that is, that
subset of tuples or rows of table should be selected within the' given relation for which a
particular condition is satisfied.
In mathematics, a set can have any number of subsets. A set is said to be a subset of another if all
its members are also members of the other set Thus, in the following example:
SI={1,2,3,4,5}
S2 = {2,3,4}
S2 is a subset of S 1. Since the body part of a table is a set, it is possible for it to have subsets, that
is, a selection from its tuples can be used to form another relation. However, this would be a
meaningless operation if no new information were to be gained from the new relation. On the
other hand, a subset of, say an EMPLOYEE relation, which contained all tuples where the
employee represent those employees who earn more than some given values of salary, would be
useful. What is required is that some explicit restriction be placed on the sub-setting operation.
Restriction as originally defined was defined on relations only and is achieved using the
comparison operators such as equal to (=), not equal to (< >), greater than (>), less than (<),
greater than or equal to (>=) and less than or equal to <=).
Example: Consider the database having following tables:
Assistant Professor (GAJENDRA JINAGR) 12
Here, in Supplier table
SNo Supplier number of supplier that is unique
Sname Supplier name
Examples:
We can also use lowercase Greek letter sigma (a) to denote selection.
For example: P WHERE WEIGHT < 15 Can be represented as: aweigh < 15 (P) SP where Sno = 'S l'
and Pno='P l'
******************************
Assistant Professor (GAJENDRA JINAGR) 13
Q.5 with the help of suitable example write down the difference between Relational
algebra and Tuple Relational Calculus?
Ans:
BASIS FOR
COMPARISON
RELATIONAL ALGEBRA RELATIONAL CALCULUS
Basic Relational Algebra is a Procedural
language.
Relational Claculus is Declarative
language.
States Relational Algebra states how to
obtain the result.
Relational Calculus states what
result we have to obtain.
Order Relational Algebra describes the
order in which operations have to be
performed.
Relational Calculus does not specify
the order of operations.
Domain Relational Algebra is not domain
dependent.
Relation Claculus can be domain
dependent.
Related It is close to a programming
language.
It is close to the natural language.
Relational Algebra
Relational algebra presents the basic set of operations for relational model. It is
a procedural language, which describes the procedure to obtain the result. Relational algebra is
prescriptive because it describes the order of operations in the query that specifies how to retrieve
the result of a query.
The sequence of operations in a relation algebra is called relational algebra expression. The
Relational Algebra Expression either takes one relation or two relations as an input to the expression
and produces a new relation as a result. The resultant relation obtained from the relational algebra
expressions can be further composed to the other relational algebra expression whose result will
again be a new relation.
The Relation Algebra forms the framework for implementing and optimizing queries while query
processing. Relational algebra is an integral part of relational DBMS. The fundamental operation
included in relational algebra are { Select (ς), Project (π), Union (∪ ), Set Difference (-), Cartesian
product (×) and Rename (ρ)}.
Relational Calculus
Unlike Relational Algebra, Relational Calculus is a higher level Declarativelanguage. In
converse to the relational algebra, relational calculus defines whatresult is to be obtained. Like
Relational Algebra, Relational Calculus does not specify the sequence of operations in which query
will be evaluated.
The sequence of relational calculus operations is called relational calculus expression that also
produces a new relation as a result. The Relational Calculus has two variations namely Tuple
Relational Calculus and Domain Relational Calculus.
Assistant Professor (GAJENDRA JINAGR) 14
The Tuple Relational Calculus list the tuples to selected from a relation, based on a
certain condition provided. It is formally denoted as:
{ t | P(t) }
Where t is the set of tuples fro which the condition P is true.
The next variation is Domain Relational Calculus, which in contrast to Tuple Relational Calculus list the
attributes to be selected from a relation, based on certain condition. The formal definition of Domain
Relational Calculus is as follow:
{<X1, X2, X3, . . . Xn> | P(X1, X2, X3, . . . Xn)}
Where X1, X2, X3, . . . Xn are the attributes and P is the certain condition
Key Differences Between Relational Algebra and Relational Calculus
1. The basic difference between Relational Algebra and Relational Calculus is that Relational
Algebra is a Procedural language whereas, the Relational Calculus is a Non-Procedural,
instead it is a Declarative language.
2. The Relational Algebra defines how to obtain the result whereas, the Relational Calculus
define what information the result must contain.
3. Relational Algebra specifies the sequence in which operations have to be performed in the
query. On the other hands, Relational calculus does not specify the sequence of operations
to performed in the query.
4. The Relational Algebra is not domain dependent whereas, the Relational Calculus can be
domain dependent as we have Domain Relational Calculus.
5. The Relational Algebra query language is closely related to programming language
whereas, the Relational Calculus is closely related to the Natural Language.
Q.5 Short note on Embedded SQL?
Ans: Embedded SQL :SQL can be implemented in two ways. It can be used interactively or
embedded in a host language or by using API. The use of SQL commands within a host language
(e.g., C, Java, etc.) program is called embedded query language or Embedded SQL. Although
similar capabilities are supported for a variety of host languages, the syntax sometimes varies.
Some of the advantages of embedded SQL are:
_ SQL statements can be used wherever a statement in the host language is allowed.
_ It combines the strengths of two programming environments, the procedural features of host
languages and non-procedural features of SQL.
_ SQL statements can refer to variables (must be prefixed by a colon in SQL statements) defined
in the host program.
_ Special program variables (called null indicators) are used to assign and retrieve the NULL
values to and from the database.
_ The facilities available through the interactive query language are also automatically available
to the host programs.
_ Embedded SQL along with host languages can be used to accomplish very complex and
complicated data access and manipulation tasks.
Example: The following Embedded SQL statement in C inserts a row, whose column values are
based on the values of the host language variables contained in it.
EXEC SQL
INSERT INTO Sailors VALUES (:c_sname, :c_sid, :c_rating, :c_age);
Assistant Professor (GAJENDRA JINAGR) 15
Q.6 Explain Component of JDBC Architecture and Also give the advantage of JDBC.
Ans: JDBC stands for Java Database Connectivity, which is a standard Java API for database-
independent connectivity between the Java programming language and a wide range of
databases.
The JDBC library includes APIs for each of the tasks mentioned below that are commonly
associated with database usage.
 Making a connection to a database.
 Creating SQL or MySQL statements.
 Executing SQL or MySQL queries in the database.
 Viewing & Modifying the resulting records.
Common JDBC Components
The JDBC API provides the following interfaces and classes −
 DriverManager: This class manages a list of database drivers. Matches connection
requests from the java application with the proper database driver using communication
sub protocol. The first driver that recognizes a certain subprotocol under JDBC will be used
to establish a database Connection.
 Driver: This interface handles the communications with the database server. You will
interact directly with Driver objects very rarely. Instead, you use DriverManager objects,
which manages objects of this type. It also abstracts the details associated with working
with Driver objects.
 Connection: This interface with all methods for contacting a database. The connection
object represents communication context, i.e., all communication with database is through
connection object only.
Assistant Professor (GAJENDRA JINAGR) 16
 Statement: You use objects created from this interface to submit the SQL statements to
the database. Some derived interfaces accept parameters in addition to executing stored
procedures.
 ResultSet: These objects hold data retrieved from a database after you execute an SQL
query using Statement objects. It acts as an iterator to allow you to move through its
data.
 SQLException: This class handles any errors that occur in a database application.
Advantages :
1) Can read any database if proper drivers are installed.
2) Creates XML structure of data from database automatically
3) No content conversion required
4) Query and Stored procedure supported.
5) Can be used for both Synchronus and Asynchronous processing.
6) Supports modules
******************************
Q.7 What is Normalization ? Explain 1NF,2NF,3NF and BCNF?
Ans: Normalization: Database Normalization is a technique of organizing the data in the
database. Normalization is a systematic approach of decomposing tables to eliminate data
redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion
Anomalies. It is a multi-step process that puts data into tabular form, removing duplicated data
from the relation tables.
Normalization is used for mainly two purposes,
 Eliminating redundant(useless) data.
 Ensuring data dependencies make sense i.e data is logically stored.
Problems Without Normalization
If a table is not properly normalized and have data redundancy then it will not only eat up extra
memory space but will also make it difficult to handle and update the database, without facing
data loss. Insertion, Updation and Deletion Anamolies are very frequent if database is not
normalized. To understand these anomalies let us take an example of a Student table.
rollno name branch hod office_tel
401 Akon CSE Mr. X 53337
402 Bkon CSE Mr. X 53337
403 Ckon CSE Mr. X 53337
04 Dkon CSE Mr. X 53337
Assistant Professor (GAJENDRA JINAGR) 17
In the table above, we have data of 4 Computer Sci. students. As we can see, data for the
fields branch, hod(Head of Department) and office_tel is repeated for the students who are in the
same branch in the college, this is Data Redundancy.
Normalization rules are divided into the following normal forms:
1. First Normal Form
2. Second Normal Form
3. Third Normal Form
4. BCNF
1. First Normal Form (1NF)
For a table to be in the First Normal Form, it should follow the following 4 rules:
1. It should only have single(atomic) valued attributes/columns.
2. Values stored in a column should be of the same domain
3. All the columns in a table should have unique names.
4. And the order in which data is stored, does not matter.
Rules for First Normal Form
The first normal form expects you to follow a few simple rules while designing your database, and they
are:
Rule 1: Single Valued Attributes
Each column of your table should be single valued which means they should not contain multiple values.
We will explain this with help of an example later, let's see the other rules for now.
Rule 2: Attribute Domain should not change
This is more of a "Common Sense" rule. In each column the values stored must be of the same kind or
type.
For example: If you have a column dob to save date of births of a set of people, then you cannot or you
must not save 'names' of some of them in that column along with 'date of birth' of others in that column.
It should hold only 'date of birth' for all the records/rows.
Rule 3: Unique name for Attributes/Columns
This rule expects that each column in a table should have a unique name. This is to avoid confusion at the
time of retrieving data or performing any other operation on the stored data.
If one or more columns have same name, then the DBMS system will be left confused.
Rule 4: Order doesn't matters
This rule says that the order in which you store the data in your table doesn't matter.
2.Second Normal Form (2NF)
For a table to be in the Second Normal Form,
1. It should be in the First Normal form.
2. And, it should not have Partial Dependency.
Assistant Professor (GAJENDRA JINAGR) 18
Partial Dependency: Partial dependency means that a nonprime attribute is functionally
dependent on part of a candidate key. (A nonprime attribute is an attribute that's not part of any
candidate key.) For example, let's start with R{ABCD}, and the functionaldependencies AB->CD
and A->C. The only candidate key for R is AB.
3.Third Normal Form (3NF)
A table is said to be in the Third Normal Form when,
1. It is in the Second Normal form.
2. And, it doesn't have Transitive Dependency.
A transitive dependency is a functionaldependency which holds by virtue of transitivity.
A transitive dependency can occur only in a relation that has three or more attributes. Let A, B,
and C designate three distinct attributes (or distinct collections of attributes) in the relation.
4. Boyce and Codd Normal Form (BCNF)
Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with
certain type of anomaly that is not handled by 3NF. A 3NF table which does not have multiple
overlapping candidate keys is said to be in BCNF. For a table to be in BCNF, following conditions
must be satisfied:
 R must be in 3rd Normal Form
 and, for each functional dependency ( X → Y ), X should be a super Key.
************************
Assistant Professor (GAJENDRA JINAGR) 19
Q.8 Discuss the purpose of BCNF .Describe how BCNF is better than 3NF.
Ans: To eliminate these anomalies in 3NF relations, it is necessary to carry out the normalization
process to the next higher step, the Boyce-Codd Normal Form.
BCNF is simply a stronger definition of 3NF. Since BCNF is higher form of 3NF, so a relation in
BCNF must be in 3NF. BCNF makes no explicit reference to first and second normal form as such,
nor the concept of full and transitive dependence.
BCNF states that:
• A relation R is in Boyce/Codd N/F (BCNF) if and only if every determinant is a candidate key.
Here, determinant is a simple attribute or composite attribute on which some other attributes is
fully functionally dependent.
For example: Qty is FFD on (Sno, Pno)
(Sno, Pno) --.> Qty, here
(Sno, Pno) is a composite determinant.
Sno --> Sname
Here, Sno is simple attribute determinate.
Similarities between 3NF and BCNF
The relations which are achieved after application of 3NF can also be achieved by BCNF.
For example, relation COURSE_STUDENT and STUDENT_SYSTEM_CHARGE which are not in 3NF
are also not in BCNF.
COURSE STUDENT
(Course _Code, Rollno, Name, System _Used, Hourly _Rate, Total_Hours)
Here, (Course_Code, RoIIno) ----+ Total_Hours
RoIIno ---> Name I System_Used I Hourly_Rate
Here, Rollno is a determinant but not candidate key (candidate key is course_code, Rollno) so
relation COURSE_STUDENT is not in BCNF.
In relation STUDENT_SYSTEM_CHARGE
(Rollno, Name, System _Used, Hourly_Rate)
Rollno --> Name I System_Used I Hourly_Rate
System_Used --> Hourly_Rate
Here, System_Used is also a determinant but it is not unique, so relation
STUDENT -SYSTEM -CHARGE is not in BCNF.
Now, Consider COURSE, HOUR_ASSIGNED, STUDENT_SYSTEM, CHARGE relations which are in
3NF.
COURSE (Course _Code, Course _Name, Teacher_Name)
HOUR_ASSIGNED (Course_Code, RoIIno, Total_Hours)
Assistant Professor (GAJENDRA JINAGR) 20
STUDENT_SYSTEM (Rollno, Name, System_Used)
CHARGE (System _Used, Hourly _Rate)
These relations are also in BCNF, because
Course_Code --> Course_Name I Teacher_Name (In relation COURSE)
(Course _Code, Rollno) --> Total_ Hours (In relation HOUR_ASSIGNED)
Rollno --> Name I System_Used (In relation STUDENT_SYSTEM)
System_Used --> Hourly_Rate (In relation CHARGES)
Here, each determinant is unique in its corresponding relation.
In conclusion, we can say that in these relations which have only single candidate key can be
normalized both with 3NF and BCNF without any problem.
Differences in 3NF and BCNF
In order to show the difference between 3NF and BCNF, relations having overlapping of
candidate keys are considered in detail.
Overlapping of Candidate keys
Two candidate keys overlap if they involve two or more attributes each and have an attribute in
common.
For example, in Manufacturer relation.
Manufacturer (Id_no,Name,Item_No,Quantity)
Here, Name is considered unique for each Id_No.
FD of above relation is
(Id_No, Item_No) --> Quantity
(Name, Item_No) --> Quantity
Id No --> Name
Name --> Id_No
Assistant Professor (GAJENDRA JINAGR) 21
This relation has two overlapping candidate keys, because there are two composite candidate
keys (Id_No, Item_No) and (Name,Item_No) out of which Item_No is common attribute in both
the candidate keys, so this is a case of overlapping of candidate keys.
Possible FD diagram of this case is:
Here, both the relations are in 3NF, because every non-key attribute is non-transitively fully
functional dependent on the primary key.
In above relation, there is only one non-key attribute i.e. Quantity and it is FFD and non
transitively dependent on the primary key.
Names, Id_No are not non-key attributes because they can participate into the primary key as
shown in FD diagram.
But, Manufacturer relation IS not III BCNF because this relation has four determinants
(Id-no, Item-No) [Qty depends on this combination]
(Name,Item_No) [Qty depends on this combination]
Id No [Name depends on Id_No]
Name [Id_No depends on Name]
Out of these four determinants two determinants (Id_No, Item_No) and (Name,Item_No) are
unique but Id_No and Name determinants are not candidate keys.
In order to make this relation in BCNF we non-loss decompose this relation in two projections
ID_NAME (Id_No, Name) and ID_QTY (Id_No, Item_No, Quantity).
ID_NAME relation has two detenninants Id_No, Name and both are unique.
ID_QTY has one determinant (Id_No, Item_No) and is also unique.
These two relations ID_NAME and ID_QTY removes all anomalies of Manufacturer relation.
Another Example
For example, consider a relation
Assistant Professor (GAJENDRA JINAGR) 22
SSP (Sno, Sname, Pno, Qty)
Here, Sname is considered unique for each Sno.
FD of above relation is
(Sno, Pno) - Qty
(Sname, Pno) - Qty
Sno - Sname
Sname - Sno
This relation has two overlapping candidate keys, because there are two composite candidate
keys (Sno, Pno) and (Sname, PNo) out of which Pno is common attribute in both the candidate
keys, so this is due case of overlapping of candidate keys.Possible FD diagram of this case is:
Here, both the relations are in 3NF, because every non-key attribute is non-transitively fully
functional dependent on the primary key.
In above relation, there is only one non-key attribute i.e. Qty and it is FFD and non transitively
dependent on the primary key.
Sname, Sno are not non-key attributes because they can participate into the primary key as
shown in FD diagram.
But, SSP relation is not in BCNF because this relation has four determinants:
(Sno, Pno)
(Sname, Pno)
(Sno)
(Sname)
Out of these four determinants two determinants (Sno, Pno) and (Sname, Pno) are unique but
Sno and Sname determinants are not candidate keys.
In order to make this relation in BCNF we non-loss decompose this relation in two projections SN
(Sno, Sname) and SP (Sno, Pno, Qty).
Assistant Professor (GAJENDRA JINAGR) 23
SN relation has two determinants Sno, Sname and both are unique.
SP has one determinant (Sno, Pno) and is also unique.
These two relations (SN, SP) remove all anomalies of SSP relation.
Another Case:
Consider a relation SST with attributes (Student, Subject, Teacher).
There 'are following rules applied on above relation:
• For each subject, each student of that subject is taught by only one teacher
• Each teacher teaches only one subject
• Each subject is taught by several teachers
Table shows a sample data:
FD's of above relation are
According to condition 1:
Subject, Student combination gives only one teacher
(Subject, Student) --- Teacher
According to, condition 2
Each teacher teaches only one subject
Teacher --- Subject
Since, each teacher teaches only one subject, so a student can taught one subject by only one
teacher. In other words, the combination of teacher and student can "also determine subject.
(Teacher, Student)--- Subject
Once again the relation is in 3NF,but not in BCNF.
This relation has following FDs:
(Subject, Student) --- Teacher
Teacher --- Subject
Assistant Professor (GAJENDRA JINAGR) 24
(Teacher, Student) --- Subject
This is a case of overlapping of candidate keys, because there are two composite candidate keys
(Subject, Student) and (Teacher, Student) and Student is a common attribute in both the
candidate keys. So, this database must be normalized according the BCNF.
This relation suffers again from the anomalies as discussed below:
For example, if we wish to delete the information that Kumar is study Physics, we cannot do so
without losing the information that Prof. Neha teaches Physics.
These difficulties are caused by the fact that teacher is determinant but not a candidate key.
In order to make it in BCNF, teacher must be candidate key, so original relation is replaced by two
projections ST (Student, Teacher) and TJ (Teacher, Subject).
All the anomalies which were present in SST, now removed in these two relations.
Practice Session:
Show that every two-attribute relation is in BCNF. That is, if r(X, Y) then r(X,Y) is in BCNF.
Solution: Let us consider the following cases:
a) X is the sole key of the relation. In this case, the nontrivial dependency X---> Y has X as a super
key since X c Y.
b) Y is the sole key of the relation. hi this case, the nontrivial dependency Y-->X has Y as a super
key since Y c Y.
c) Both X --> Y and Y --> X hold simultaneously. Then whatever PK we consider for the relation we
will have either X or Y as its determinant. Either one of the two possible cases has already been
considered under (a) or (b).
Consider the relation Supplier (Supplier-No, Part-No. Supplier-Name, Supplier-
Control, Price) and assume that only the following FDs hold for this relation: Supplier-No ---
>Supplier-Name, Supplier-No ~ Supplier-Control. What type of data anomalies does this relation
have in its present form? Transform it to 3NF if not already in that form.
Solution: This relation present insertion anomalies, deletion anomalies and update anomalies. In
this relation we cannot enter a Supplier-Control until that supplier supplies a part (insertion
anomaly). Notice that this is necessary to preserve the integrity constraint of the key. If a supplier
stops temporarily supplying a particular part, then the deletion of the last tuple containing that
Supplier-No also deletes the Supplier-Control of the supplier (deletion anomaly). Finally, if the
Supplier-Control of a particular supplier needs to be updated, we must look for every tuple that
contains that supplier as part of the key. If a supplier supplies many parts and we fail to update all
the corresponding tuple, the database may end up in an inconsistent state. We can transform this
relation into a 2NF as follows:
Supplier (Supplier-No, Supplier-Name, Supplier-Control) and
Part (Part-No, Supplier-No, Price)
Assistant Professor (GAJENDRA JINAGR) 25
Consider the relation for release RECORD (Title, Performer, Style, Price, Label, Producer) and the
dependencies shown below. Indicate what the highest normal form of this relation is. Indicate a
possible 3NF decomposition of this relation.
Title --> Label, Style Style --> Price Performer --> Producer
Solution: The key of the relation is the composite attribute Title, Performer. As it stands the
relation is in INF because there is at least one partial dependency on the key. For example,
Performer - Producer. A possible decomposition may be Record (Title, Performer), Genre (Title,
Label, Style), Producer (Performer, Producer- Name), Cost(Style, Price).

More Related Content

What's hot

Lecture 1&amp;2(rdbms-ii)
Lecture 1&amp;2(rdbms-ii)Lecture 1&amp;2(rdbms-ii)
Lecture 1&amp;2(rdbms-ii)Ravinder Kamboj
 
Dbms role advantages
Dbms role advantagesDbms role advantages
Dbms role advantagesjeancly
 
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]Usman Tariq
 
Data base management
Data base management Data base management
Data base management MiXvideos
 
data base management report
data base management report data base management report
data base management report shivam tripathi
 
Week 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data ModelsWeek 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data Modelsoudesign
 
A Survey on Big Data Analytics
A Survey on Big Data AnalyticsA Survey on Big Data Analytics
A Survey on Big Data AnalyticsBHARATH KUMAR
 
Database design challenges conflicting goals
Database design challenges conflicting goalsDatabase design challenges conflicting goals
Database design challenges conflicting goalsmarkilyn
 
Database design, implementation, and management -chapter02
Database design, implementation, and management -chapter02Database design, implementation, and management -chapter02
Database design, implementation, and management -chapter02Beni Krisbiantoro
 
Pmit 6102-14-lec1-intro
Pmit 6102-14-lec1-introPmit 6102-14-lec1-intro
Pmit 6102-14-lec1-introJesmin Rahaman
 
Modern database management system chapter 1
Modern database management system chapter 1Modern database management system chapter 1
Modern database management system chapter 1AyeshaShoukat5
 
Dbms interview questions s.pdf
Dbms interview questions s.pdfDbms interview questions s.pdf
Dbms interview questions s.pdfShivani139202
 
Database Management System
Database Management SystemDatabase Management System
Database Management SystemRHIMRJ Journal
 
Dbms and it infrastructure
Dbms and  it infrastructureDbms and  it infrastructure
Dbms and it infrastructureprojectandppt
 
Mi0034 database management systems
Mi0034  database management systemsMi0034  database management systems
Mi0034 database management systemssmumbahelp
 

What's hot (19)

Lecture 1&amp;2(rdbms-ii)
Lecture 1&amp;2(rdbms-ii)Lecture 1&amp;2(rdbms-ii)
Lecture 1&amp;2(rdbms-ii)
 
Dbms role advantages
Dbms role advantagesDbms role advantages
Dbms role advantages
 
Dbms9
Dbms9Dbms9
Dbms9
 
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
 
Data base management
Data base management Data base management
Data base management
 
data base management report
data base management report data base management report
data base management report
 
Week 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data ModelsWeek 2 Characteristics & Benefits of a Database & Types of Data Models
Week 2 Characteristics & Benefits of a Database & Types of Data Models
 
A Survey on Big Data Analytics
A Survey on Big Data AnalyticsA Survey on Big Data Analytics
A Survey on Big Data Analytics
 
Database design challenges conflicting goals
Database design challenges conflicting goalsDatabase design challenges conflicting goals
Database design challenges conflicting goals
 
Database design, implementation, and management -chapter02
Database design, implementation, and management -chapter02Database design, implementation, and management -chapter02
Database design, implementation, and management -chapter02
 
Pmit 6102-14-lec1-intro
Pmit 6102-14-lec1-introPmit 6102-14-lec1-intro
Pmit 6102-14-lec1-intro
 
data base manage ment
data base manage mentdata base manage ment
data base manage ment
 
Modern database management system chapter 1
Modern database management system chapter 1Modern database management system chapter 1
Modern database management system chapter 1
 
Dbms interview questions s.pdf
Dbms interview questions s.pdfDbms interview questions s.pdf
Dbms interview questions s.pdf
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Dbms and it infrastructure
Dbms and  it infrastructureDbms and  it infrastructure
Dbms and it infrastructure
 
ans3ed-oddonly.pdf
ans3ed-oddonly.pdfans3ed-oddonly.pdf
ans3ed-oddonly.pdf
 
Mi0034 database management systems
Mi0034  database management systemsMi0034  database management systems
Mi0034 database management systems
 
Dbms notes
Dbms notesDbms notes
Dbms notes
 

Similar to DBMS TITLE

Database Management System
Database Management SystemDatabase Management System
Database Management SystemTamur Iqbal
 
Advantages of Database Approach The Farber Consulting Group, Inc
Advantages of Database Approach The Farber Consulting Group, IncAdvantages of Database Approach The Farber Consulting Group, Inc
Advantages of Database Approach The Farber Consulting Group, IncThe Farber Consulting Group, Inc
 
1. Chapter One.pdf
1. Chapter One.pdf1. Chapter One.pdf
1. Chapter One.pdffikadumola
 
Unit 2 rdbms study_material
Unit 2  rdbms study_materialUnit 2  rdbms study_material
Unit 2 rdbms study_materialgayaramesh
 
DBMS-1.pptx
DBMS-1.pptxDBMS-1.pptx
DBMS-1.pptxkingVox
 
database disegn.pptx
database disegn.pptxdatabase disegn.pptx
database disegn.pptxBARHAMMUSIC
 
DBMS-material for b.tech students to learn
DBMS-material for b.tech students to learnDBMS-material for b.tech students to learn
DBMS-material for b.tech students to learnRajasekhar364622
 
TID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To DatabaseTID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To DatabaseWanBK Leo
 
Database Management System.pptx
Database Management System.pptxDatabase Management System.pptx
Database Management System.pptxAaravSharma743156
 
data base unit one on what is databases.pptx
data base unit one on what is databases.pptxdata base unit one on what is databases.pptx
data base unit one on what is databases.pptxmulukendemis44
 
Dbms environment and components ppt.pptx
Dbms environment and components ppt.pptxDbms environment and components ppt.pptx
Dbms environment and components ppt.pptxRITIKRAJ437758
 

Similar to DBMS TITLE (20)

Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Advantages of Database Approach-converted.pdf
Advantages of Database Approach-converted.pdfAdvantages of Database Approach-converted.pdf
Advantages of Database Approach-converted.pdf
 
Advantages of Database Approach The Farber Consulting Group, Inc
Advantages of Database Approach The Farber Consulting Group, IncAdvantages of Database Approach The Farber Consulting Group, Inc
Advantages of Database Approach The Farber Consulting Group, Inc
 
DBMS NOTES.pdf
DBMS  NOTES.pdfDBMS  NOTES.pdf
DBMS NOTES.pdf
 
1. Chapter One.pdf
1. Chapter One.pdf1. Chapter One.pdf
1. Chapter One.pdf
 
database ppt(2)
database ppt(2)database ppt(2)
database ppt(2)
 
Unit 2 rdbms study_material
Unit 2  rdbms study_materialUnit 2  rdbms study_material
Unit 2 rdbms study_material
 
DBMS-1.pptx
DBMS-1.pptxDBMS-1.pptx
DBMS-1.pptx
 
database disegn.pptx
database disegn.pptxdatabase disegn.pptx
database disegn.pptx
 
DBMS-material for b.tech students to learn
DBMS-material for b.tech students to learnDBMS-material for b.tech students to learn
DBMS-material for b.tech students to learn
 
MS-CIT Unit 9.pptx
MS-CIT Unit 9.pptxMS-CIT Unit 9.pptx
MS-CIT Unit 9.pptx
 
Ch01
Ch01Ch01
Ch01
 
Dbms models
Dbms modelsDbms models
Dbms models
 
TID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To DatabaseTID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To Database
 
Database Management System.pptx
Database Management System.pptxDatabase Management System.pptx
Database Management System.pptx
 
data base unit one on what is databases.pptx
data base unit one on what is databases.pptxdata base unit one on what is databases.pptx
data base unit one on what is databases.pptx
 
File system vs DBMS
File system vs DBMSFile system vs DBMS
File system vs DBMS
 
Dbms environment and components ppt.pptx
Dbms environment and components ppt.pptxDbms environment and components ppt.pptx
Dbms environment and components ppt.pptx
 
DBMS and its Models
DBMS and its ModelsDBMS and its Models
DBMS and its Models
 
Data models
Data modelsData models
Data models
 

More from Anjaan Gajendra

Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbmsAnjaan Gajendra
 
Bca examination 2015 dbms
Bca examination 2015 dbmsBca examination 2015 dbms
Bca examination 2015 dbmsAnjaan Gajendra
 
Bca examination 2016 csa
Bca examination 2016 csaBca examination 2016 csa
Bca examination 2016 csaAnjaan Gajendra
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csaAnjaan Gajendra
 
Computer system architecture (microprocessor 8085) unit 4
Computer system architecture (microprocessor 8085) unit  4Computer system architecture (microprocessor 8085) unit  4
Computer system architecture (microprocessor 8085) unit 4Anjaan Gajendra
 

More from Anjaan Gajendra (10)

Bca examination 2017 dbms
Bca examination 2017 dbmsBca examination 2017 dbms
Bca examination 2017 dbms
 
Bca examination 2015 dbms
Bca examination 2015 dbmsBca examination 2015 dbms
Bca examination 2015 dbms
 
Bca examination 2016 csa
Bca examination 2016 csaBca examination 2016 csa
Bca examination 2016 csa
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csa
 
Sql query file work
Sql query file workSql query file work
Sql query file work
 
Multi media unit-4.doc
Multi media unit-4.docMulti media unit-4.doc
Multi media unit-4.doc
 
Multi media unit-3.doc
Multi media unit-3.docMulti media unit-3.doc
Multi media unit-3.doc
 
Multi media unit-2.doc
Multi media unit-2.docMulti media unit-2.doc
Multi media unit-2.doc
 
Multimedia notes
Multimedia  notesMultimedia  notes
Multimedia notes
 
Computer system architecture (microprocessor 8085) unit 4
Computer system architecture (microprocessor 8085) unit  4Computer system architecture (microprocessor 8085) unit  4
Computer system architecture (microprocessor 8085) unit 4
 

Recently uploaded

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

DBMS TITLE

  • 1. Assistant Professor (GAJENDRA JINAGR) 1 BCA EXAMINATION 2016 DBMS Q.1 a)List Out Four Significance Difference Between A File Processing System And DBMS? Ans: File Processing System Database Management System On the other hand, a file system is a more unstructured data store for storing arbitrary, probably unrelated data. A database is generally used for storing related, structured data, with well defined data formats, in an efficient manner for insert, update and/or retrieval. A file system provides much looser guarantees about consistency, isolation and durability. While databases are consistent at any instant in time,provide,isolated transactions and durable writes, A file-processing system coordinates only the physical access to the data. A database management system coordinates both the physical and the logical access to the data A file-processing system is designed to allow predetermined access to data (i.e. compiled programs) A database management system is designed to allow flexible access to data (i.e. queries) Unauthorized access cannot be restricted in DBMS Unauthorized access is restricted in DBMS Redundancy cannot be controlled in File processing system. Redundancy can be controlled in File processing system. Q.1 State and Explain the advantages and disadvantages of DBMS? Ans: Advantages of Database Management System (DBMS) 1. Improved data sharing An advantage of the database management approach is, the DBMS helps to create an environment in which end users have better access to more and better-managed data. Such access makes it possible for end users to respond quickly to changes in their environment. 2. Improved data security The more users access the data, the greater the risks of data security breaches. Corporations invest considerable amounts of time, effort, and money to ensure that corporate data are used properly. A DBMS provides a framework for better enforcement of data privacy and security policies. 3. Better data integration Wider access to well-managed data promotes an integrated view of the organization’s operations and a clearer view of the big picture. It becomes much easier to see how actions in one segment of the company affect other segments.
  • 2. Assistant Professor (GAJENDRA JINAGR) 2 4. Minimized data inconsistency Data inconsistency exists when different versions of the same data appear in different places. For example, data inconsistency exists when a company’s sales department stores a sales representative’s name as “Bill Brown” and the company’s personnel department stores that same person’s name as “William G. Brown,” or when the company’s regional sales office shows the price of a product as $45.95 and its national sales office shows the same product’s price as $43.95. The probability of data inconsistency is greatly reduced in a properly designed database. 5. Improved data access The DBMS makes it possible to produce quick answers to ad hoc queries. From a database perspective, a query is a specific request issued to the DBMS for data manipulation—for example, to read or update the data. Simply put, a query is a question, and an ad hoc query is a spur-of-the-moment question. The DBMS sends back an answer (called the query result set) to the application. For example, end users, when dealing with large amounts of sales data, might want quick answers to questions (ad hoc queries) such as: - What was the dollar volume of sales by product during the past six months? - What is the sales bonus figure for each of our salespeople during the past three months? - How many of our customers have credit balances of 3,000 or more? 6. Improved decision making Better-managed data and improved data access make it possible to generate better- quality information, on which better decisions are based. The quality of the information generated depends on the quality of the underlying data. Data quality is a comprehensive approach to promoting the accuracy, validity, and timeliness of the data. While the DBMS does not guarantee data quality, it provides a framework to facilitate data quality initiatives. 7. Increased end-user productivity The availability of data, combined with the tools that transform data into usable information, empowers end users to make quick, informed decisions that can make the difference between success and failure in the global economy. Till now we have seen different benefits of database management systems. But it has certain limitations or disadvantages. Let's find various disadvantages of database system. Disadvantages of Database Management System (DBMS): Although the database system yields considerable advantages over previous data management approaches, database systems do carry significant disadvantages. For example: 1. Increased costs one of the disadvantages of dbms is Database systems require sophisticated hardware and software and highly skilled personnel. The cost of maintaining the hardware, software, and personnel required to operate and manage a database system can be substantial. Training, licensing, and regulation compliance costs are often overlooked when database systems are implemented. 2. Management complexity Database systems interface with many different technologies and have a significant impact on a company’s resources and culture. The changes introduced by the adoption of a database
  • 3. Assistant Professor (GAJENDRA JINAGR) 3 system must be properly managed to ensure that they help advance the company’s objectives. Given the fact that database systems hold crucial company data that are accessed from multiple sources, security issues must be assessed constantly. 3. Maintaining currency To maximize the efficiency of the database system, you must keep your system current. Therefore, you must perform frequent updates and apply the latest patches and security measures to all components. Because database technology advances rapidly, personnel training costs tend to be significant. Vendor dependence. Given the heavy investment in technology and personnel training, companies might be reluctant to change database vendors. As a consequence, vendors are less likely to offer pricing point advantages to existing customers, and those customers might be limited in their choice of database system components. 4. Frequent upgrade/replacement cycles DBMS vendors frequently upgrade their products by adding new functionality. Such new features often come bundled in new upgrade versions of the software. Some of these versions require hardware upgrades. Not only do the upgrades themselves cost money, but it also costs money to train database users and administrators to properly use and manage the new features. *********************************** Q.2 Define and explain different levels of Data Abstraction? Ans: Database systems are made-up of complex data structures. To ease the user interaction with database, the developers hide internal irrelevant details from users. This process of hiding irrelevant details from user is called data abstraction. We have three levels of abstraction: Physical level: This is the lowest level of data abstraction. It describes how data is actually stored in database. You can get the complex data structure details at this level. Logical level: This is the middle level of 3-level data abstraction architecture. It describes what data is stored in database. View level: Highest level of data abstraction. This level describes the user interaction with database system.
  • 4. Assistant Professor (GAJENDRA JINAGR) 4 1. Physical Level: o How the data are stored. o E.g. index, B-tree, hashing. o Lowest level of abstraction. o Complex low-level structures described in detail. 2. Conceptual Level: o Next highest level of abstraction. o Describes what data are stored. o Describes the relationships among data. o Database administrator level. 3. View Level: o Highest level. o Describes part of the database for a particular group of users. o Can be many different views of a database. o E.g. tellers in a bank get a view of customer accounts, but not of payroll data. Example: Let’s say we are storing customer information in a customer table. At physical level these records can be described as blocks of storage (bytes, gigabytes, terabytes etc.) in memory. These details are often hidden from the programmers. At the logical level these records can be described as fields and attributes along with their data types, their relationship among each other can be logically implemented. The programmers generally work at this level because they are aware of such things about database systems. At view level, user just interact with system with the help of GUI and enter the details at the screen, they are not aware of how the data is stored and what data is stored; such details are hidden from them. Q.2 What is data model and explain E-R data model with suitable example? Ans: A database model shows the logical structure of a database, including the relationships and constraints that determine how data can be stored and accessed. Individual database models are designed based on the rules and concepts of whichever broader data model the designers adopt. Most data models can be represented by an accompanying database diagram. Types of database models There are many kinds of data models. Some of the most common ones include:  Hierarchical database model  Relational model  Network model  Object-oriented database model  Entity-relationship model
  • 5. Assistant Professor (GAJENDRA JINAGR) 5 Entity-relationship model This model captures the relationships between real-world entities much like the network model, but it isn’t as directly tied to the physical structure of the database. Instead, it’s often used for designing a database conceptually. Here, the people, places, and things about which data points are stored are referred to as entities, each of which has certain attributes that together make up their domain. The cardinality, or relationships between entities, are mapped as well. In a logical sense, entities are the equivalent of grammatical nouns, such as employees, departments, products, or networks. An entity can be defined by means of its properties, called attributes. Relationships are the equivalent of verbs or associations, such as the act of purchasing, the act of repairing, being a member of a group, or being a supervisor of a department. A relationship can be defined according to the number of entities associated with it, known as the degree. the ER model is considered a good option for designing databases. 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. An entity set is a collection of similar types of entities. An entity set may contain entities with attribute sharing similar values. For example, a Students set may contain all the students of a school; likewise a Teachers set may contain all the teachers of a school from all faculties. Entity sets need not be disjoint. Attributes Entities are represented by means of their properties, called attributes. All attributes have values. For example, a student entity may have name, class, and age as attributes. There exists a domain or range of values that can be assigned to attributes. For example, a student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be negative, etc. Relationship The association among entities is called a relationship. For example, an employee works_at a department, a student enrolls in a course. Here, Works_at and Enrolls are called relationships. Relationship Set A set of relationships of similar type is called a relationship set. Like entities, a relationship too can have attributes. These attributes are called descriptive attributes.
  • 6. Assistant Professor (GAJENDRA JINAGR) 6 Degree of Relationship The number of participating entities in a relationship defines the degree of the relationship.  Binary = degree 2  Ternary = degree 3  n-ary = degree The number of participating entities in a relationship defines the degree of the relationship.  Binary = degree 2  Ternary = degree 3  n-ary = degree **************************** Q.3 Define with suitable example? Ans: (I) Super Key – An attribute or a combination of attribute that is used to identify the records uniquely is known as Super Key. A table can have many Super Keys. E.g. of Super Key 1 ID 2 ID, Name 3 ID, Address 4 ID, Department_ID 5 ID, Salary 6 Name, Address 7 Name, Address, Department_ID ………… So on as any combination which can identify the records uniquely will be a Super Key.
  • 7. Assistant Professor (GAJENDRA JINAGR) 7 (II) Candidate Key – It can be defined as minimal Super Key or irreducible Super Key. In other words an attribute or a combination of attribute that identifies the record uniquely but none of its proper subsets can identify the records uniquely. E.g. of Candidate Key 1 Code 2 Name, Address For above table we have only two Candidate Keys (i.e. Irreducible Super Key) used to identify the records from the table uniquely. Code Key can identify the record uniquely and similarly combination of Name and Address can identify the record uniquely, but neither Name nor Address can be used to identify the records uniquely as it might be possible that we have two employees with similar name or two employees from the same house. (III) Primary Key – A Candidate Key that is used by the database designer for unique identification of each row in a table is known as Primary Key. A Primary Key can consist of one or more attributes of a table. E.g. of Primary Key - Database designer can use one of the Candidate Key as a Primary Key. In this case we have “Code” and “Name, Address” as Candidate Key, we will consider “Code” Key as a Primary Key as the other key is the combination of more than one attribute. (IV) Foreign Key – A foreign key is an attribute or combination of attribute in one base table that points to the candidate key (generally it is the primary key) of another table. The purpose of the foreign key is to ensure referential integrity of the data i.e. only values that are supposed to appear in the database are permitted. E.g. of Foreign Key – Let consider we have another table i.e. Department Table with Attributes “Department_ID”, “Department_Name”, “Manager_ID”, ”Location_ID” with Department_ID as an Primary Key. Now the Department_ID attribute of Employee Table (dependent or child table) can be defined as the Foreign Key as it can reference to the Department_ID attribute of the Departments table (the referenced or parent table), a Foreign Key value must match an existing value in the parent table or be NULL. *************************** Q.4 a)Write difference between Tuples relational and Domain relational calculus? Ans: Tuple Oriented Relational Calculus The basic construct of tuple calculus is a tuple calculus expression. Tuple Calculus expressions are made up of following constructs or elements.    
  • 8. Assistant Professor (GAJENDRA JINAGR) 8  TupleVariable: A tuple variable is a variable that ‘ ranges over’ some named relation i.e. a variable whose only permitted values are tuple of that relation. Tuple variables are denoted by uppercase letters. For example T, U, V etc. If the tuple variable T represents tuple t (at given time), then the expression T. A represents the A component of t( at that time), where A is an attribute of the relation over which T Ranges.  Conditions : Conditions are of the form x * y, where * is any relational operator =, !=, <, <=, >, >= and at least one of the x & y is an expression of the form T.A & other is either a similar expression or a constant.  Well Formed Formulas (WFFs) : A WFF is constructed from conditions, Boolean operators ( AND, OR, NOT) and quantifiers (∃, ∀) according to the following rules: o Every condition is WFF. o If f is a WFFs, then (f) and NOT(f) are also WFFs. o If f and G are WFFs, then (f AND g) and (f oOR g) are also WFFs. o If f is WFF in which T occurs as a free variable then ∃T(f) are WFFs. o Nothing else is a WFF.  Criteria for free and bound variables : o Within the condition all tuple variable occurrences are free. o Tuple variable occurrence in the WFFs(f), NOT(f) are free/bound according as they are free/bound in f. o Tuple variable occurrences in the WFFs(f AND g), (f OR g) are free/bound according as they are free/bound in f or g. o Occurrence of T that are free in f are bound in the WFFs ∃T(f), ∀ T(f). Other tuple variable occurrence in f are free/bound in these WFFs as they are free/bound in f. Domain Oriented Relational Calculus The domain oriented relational calculus differs from the tuples calculus in that its variable ranges over domain rather than relations. Expressions of the domain calculus are constructed from the following elements.  Domain Variables : Domain variables are denoted by uppercase letters. For example D,E,F etc. Each domain variable is constrained to range over some specified domain.  Conditions : Conditions can takes two forms : 1. Simply comparisons : Form is x * y, same as for the tuple calculus, except that x and y are now the domain variables ( or constants). 2. Membership Condition : The form is R (term, term, …..). Here R is a relation and each “term” is a pair A : V, where A is an attribute of R and V is either a domain variable or a constant.
  • 9. Assistant Professor (GAJENDRA JINAGR) 9  Well Formed Formulas (WFFs): Same as tuple calculus section but with revised definition of condition  Free and Bound Variables : Same as tuple calculus.  Domain Calculus Expressions : A domain calculus expression is then an expression of the form D, E, ….., F *WHERE f+ where D, E, ….., F are domain variables and f is a WFF containing exactly D, E, ….., F are free variables. The values of this expression is that subset of the cartesian product D x E x …. x F (where D, E, ….., F range over all their possible values) for which f evaluated to true – or if “WHERE f” is omitted that entire cartesian product. Q..4 B) Define the operation Given Below? Ans: 1.Projection: The ·projection operation on a table simply forms another table by copying specified columns (both header and body parts) from the original table, eliminating any duplicated rows. The projection operator yields a vertical subset of a given relation - that is, that subset obtained by selecting specified attributes, in a specified left to right order, and then eliminating duplicate tuples within the attributes selected. Projection is denoted by the Greek letter pi(TI). For example, consider the table EMPLOYEE, as shown: The projections of the 'age', the 'age and salary' and the 'personnel_number and name' columns would return the three tables, say, A, B and C respectively: 2. UNION: n mathematical set theory, the union of two sets is the set of all elements belonging to both sets. The set, which results from the union, must not, of course, contain duplicate elements. It is denoted by U. Thus the union of sets: Sl = {1, 2, 3, 4, 5} and
  • 10. Assistant Professor (GAJENDRA JINAGR) 10 S2= {4,5,6,7,8} would be the set {l, 2,3,4,5,6,7,8}. A union operation on two relational tables follows the same basic principle but is more complex in practice. In order to perform the Union operation, both operand relations must be union- compatible i.e. they must have same number of columns drawn from the same domain (means must be of same data type). Suppose that two tables, R and the S have the following tuples at some instant in time, and that their header parts are as shown below: These can certainly be combined in to one table containing a valid relation by the relational union operator ( R US) as follows: 3.INTERSECTION: In mathematics an intersection of two sets produces a set, which contains . all the elements those are common to both sets. It is denoted by n., Thus the intersection of the two sets: Sl = { 1,2,3,4,5} and S2= {4,5,6,7,8} would be {4,5}. In above example, both the tables are union compatible and it can be intersected together. The intersection operation on the R and Stables (R n S) defined above would return: The intersection operator is used in a similar fashion to the union operation, but provides an 'and' function.
  • 11. Assistant Professor (GAJENDRA JINAGR) 11 4.SELECTION: The selection operator yields a 'horizontal subset of a given relation that is, that subset of tuples or rows of table should be selected within the' given relation for which a particular condition is satisfied. In mathematics, a set can have any number of subsets. A set is said to be a subset of another if all its members are also members of the other set Thus, in the following example: SI={1,2,3,4,5} S2 = {2,3,4} S2 is a subset of S 1. Since the body part of a table is a set, it is possible for it to have subsets, that is, a selection from its tuples can be used to form another relation. However, this would be a meaningless operation if no new information were to be gained from the new relation. On the other hand, a subset of, say an EMPLOYEE relation, which contained all tuples where the employee represent those employees who earn more than some given values of salary, would be useful. What is required is that some explicit restriction be placed on the sub-setting operation. Restriction as originally defined was defined on relations only and is achieved using the comparison operators such as equal to (=), not equal to (< >), greater than (>), less than (<), greater than or equal to (>=) and less than or equal to <=). Example: Consider the database having following tables:
  • 12. Assistant Professor (GAJENDRA JINAGR) 12 Here, in Supplier table SNo Supplier number of supplier that is unique Sname Supplier name Examples: We can also use lowercase Greek letter sigma (a) to denote selection. For example: P WHERE WEIGHT < 15 Can be represented as: aweigh < 15 (P) SP where Sno = 'S l' and Pno='P l' ******************************
  • 13. Assistant Professor (GAJENDRA JINAGR) 13 Q.5 with the help of suitable example write down the difference between Relational algebra and Tuple Relational Calculus? Ans: BASIS FOR COMPARISON RELATIONAL ALGEBRA RELATIONAL CALCULUS Basic Relational Algebra is a Procedural language. Relational Claculus is Declarative language. States Relational Algebra states how to obtain the result. Relational Calculus states what result we have to obtain. Order Relational Algebra describes the order in which operations have to be performed. Relational Calculus does not specify the order of operations. Domain Relational Algebra is not domain dependent. Relation Claculus can be domain dependent. Related It is close to a programming language. It is close to the natural language. Relational Algebra Relational algebra presents the basic set of operations for relational model. It is a procedural language, which describes the procedure to obtain the result. Relational algebra is prescriptive because it describes the order of operations in the query that specifies how to retrieve the result of a query. The sequence of operations in a relation algebra is called relational algebra expression. The Relational Algebra Expression either takes one relation or two relations as an input to the expression and produces a new relation as a result. The resultant relation obtained from the relational algebra expressions can be further composed to the other relational algebra expression whose result will again be a new relation. The Relation Algebra forms the framework for implementing and optimizing queries while query processing. Relational algebra is an integral part of relational DBMS. The fundamental operation included in relational algebra are { Select (ς), Project (π), Union (∪ ), Set Difference (-), Cartesian product (×) and Rename (ρ)}. Relational Calculus Unlike Relational Algebra, Relational Calculus is a higher level Declarativelanguage. In converse to the relational algebra, relational calculus defines whatresult is to be obtained. Like Relational Algebra, Relational Calculus does not specify the sequence of operations in which query will be evaluated. The sequence of relational calculus operations is called relational calculus expression that also produces a new relation as a result. The Relational Calculus has two variations namely Tuple Relational Calculus and Domain Relational Calculus.
  • 14. Assistant Professor (GAJENDRA JINAGR) 14 The Tuple Relational Calculus list the tuples to selected from a relation, based on a certain condition provided. It is formally denoted as: { t | P(t) } Where t is the set of tuples fro which the condition P is true. The next variation is Domain Relational Calculus, which in contrast to Tuple Relational Calculus list the attributes to be selected from a relation, based on certain condition. The formal definition of Domain Relational Calculus is as follow: {<X1, X2, X3, . . . Xn> | P(X1, X2, X3, . . . Xn)} Where X1, X2, X3, . . . Xn are the attributes and P is the certain condition Key Differences Between Relational Algebra and Relational Calculus 1. The basic difference between Relational Algebra and Relational Calculus is that Relational Algebra is a Procedural language whereas, the Relational Calculus is a Non-Procedural, instead it is a Declarative language. 2. The Relational Algebra defines how to obtain the result whereas, the Relational Calculus define what information the result must contain. 3. Relational Algebra specifies the sequence in which operations have to be performed in the query. On the other hands, Relational calculus does not specify the sequence of operations to performed in the query. 4. The Relational Algebra is not domain dependent whereas, the Relational Calculus can be domain dependent as we have Domain Relational Calculus. 5. The Relational Algebra query language is closely related to programming language whereas, the Relational Calculus is closely related to the Natural Language. Q.5 Short note on Embedded SQL? Ans: Embedded SQL :SQL can be implemented in two ways. It can be used interactively or embedded in a host language or by using API. The use of SQL commands within a host language (e.g., C, Java, etc.) program is called embedded query language or Embedded SQL. Although similar capabilities are supported for a variety of host languages, the syntax sometimes varies. Some of the advantages of embedded SQL are: _ SQL statements can be used wherever a statement in the host language is allowed. _ It combines the strengths of two programming environments, the procedural features of host languages and non-procedural features of SQL. _ SQL statements can refer to variables (must be prefixed by a colon in SQL statements) defined in the host program. _ Special program variables (called null indicators) are used to assign and retrieve the NULL values to and from the database. _ The facilities available through the interactive query language are also automatically available to the host programs. _ Embedded SQL along with host languages can be used to accomplish very complex and complicated data access and manipulation tasks. Example: The following Embedded SQL statement in C inserts a row, whose column values are based on the values of the host language variables contained in it. EXEC SQL INSERT INTO Sailors VALUES (:c_sname, :c_sid, :c_rating, :c_age);
  • 15. Assistant Professor (GAJENDRA JINAGR) 15 Q.6 Explain Component of JDBC Architecture and Also give the advantage of JDBC. Ans: JDBC stands for Java Database Connectivity, which is a standard Java API for database- independent connectivity between the Java programming language and a wide range of databases. The JDBC library includes APIs for each of the tasks mentioned below that are commonly associated with database usage.  Making a connection to a database.  Creating SQL or MySQL statements.  Executing SQL or MySQL queries in the database.  Viewing & Modifying the resulting records. Common JDBC Components The JDBC API provides the following interfaces and classes −  DriverManager: This class manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication sub protocol. The first driver that recognizes a certain subprotocol under JDBC will be used to establish a database Connection.  Driver: This interface handles the communications with the database server. You will interact directly with Driver objects very rarely. Instead, you use DriverManager objects, which manages objects of this type. It also abstracts the details associated with working with Driver objects.  Connection: This interface with all methods for contacting a database. The connection object represents communication context, i.e., all communication with database is through connection object only.
  • 16. Assistant Professor (GAJENDRA JINAGR) 16  Statement: You use objects created from this interface to submit the SQL statements to the database. Some derived interfaces accept parameters in addition to executing stored procedures.  ResultSet: These objects hold data retrieved from a database after you execute an SQL query using Statement objects. It acts as an iterator to allow you to move through its data.  SQLException: This class handles any errors that occur in a database application. Advantages : 1) Can read any database if proper drivers are installed. 2) Creates XML structure of data from database automatically 3) No content conversion required 4) Query and Stored procedure supported. 5) Can be used for both Synchronus and Asynchronous processing. 6) Supports modules ****************************** Q.7 What is Normalization ? Explain 1NF,2NF,3NF and BCNF? Ans: Normalization: Database Normalization is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form, removing duplicated data from the relation tables. Normalization is used for mainly two purposes,  Eliminating redundant(useless) data.  Ensuring data dependencies make sense i.e data is logically stored. Problems Without Normalization If a table is not properly normalized and have data redundancy then it will not only eat up extra memory space but will also make it difficult to handle and update the database, without facing data loss. Insertion, Updation and Deletion Anamolies are very frequent if database is not normalized. To understand these anomalies let us take an example of a Student table. rollno name branch hod office_tel 401 Akon CSE Mr. X 53337 402 Bkon CSE Mr. X 53337 403 Ckon CSE Mr. X 53337 04 Dkon CSE Mr. X 53337
  • 17. Assistant Professor (GAJENDRA JINAGR) 17 In the table above, we have data of 4 Computer Sci. students. As we can see, data for the fields branch, hod(Head of Department) and office_tel is repeated for the students who are in the same branch in the college, this is Data Redundancy. Normalization rules are divided into the following normal forms: 1. First Normal Form 2. Second Normal Form 3. Third Normal Form 4. BCNF 1. First Normal Form (1NF) For a table to be in the First Normal Form, it should follow the following 4 rules: 1. It should only have single(atomic) valued attributes/columns. 2. Values stored in a column should be of the same domain 3. All the columns in a table should have unique names. 4. And the order in which data is stored, does not matter. Rules for First Normal Form The first normal form expects you to follow a few simple rules while designing your database, and they are: Rule 1: Single Valued Attributes Each column of your table should be single valued which means they should not contain multiple values. We will explain this with help of an example later, let's see the other rules for now. Rule 2: Attribute Domain should not change This is more of a "Common Sense" rule. In each column the values stored must be of the same kind or type. For example: If you have a column dob to save date of births of a set of people, then you cannot or you must not save 'names' of some of them in that column along with 'date of birth' of others in that column. It should hold only 'date of birth' for all the records/rows. Rule 3: Unique name for Attributes/Columns This rule expects that each column in a table should have a unique name. This is to avoid confusion at the time of retrieving data or performing any other operation on the stored data. If one or more columns have same name, then the DBMS system will be left confused. Rule 4: Order doesn't matters This rule says that the order in which you store the data in your table doesn't matter. 2.Second Normal Form (2NF) For a table to be in the Second Normal Form, 1. It should be in the First Normal form. 2. And, it should not have Partial Dependency.
  • 18. Assistant Professor (GAJENDRA JINAGR) 18 Partial Dependency: Partial dependency means that a nonprime attribute is functionally dependent on part of a candidate key. (A nonprime attribute is an attribute that's not part of any candidate key.) For example, let's start with R{ABCD}, and the functionaldependencies AB->CD and A->C. The only candidate key for R is AB. 3.Third Normal Form (3NF) A table is said to be in the Third Normal Form when, 1. It is in the Second Normal form. 2. And, it doesn't have Transitive Dependency. A transitive dependency is a functionaldependency which holds by virtue of transitivity. A transitive dependency can occur only in a relation that has three or more attributes. Let A, B, and C designate three distinct attributes (or distinct collections of attributes) in the relation. 4. Boyce and Codd Normal Form (BCNF) Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with certain type of anomaly that is not handled by 3NF. A 3NF table which does not have multiple overlapping candidate keys is said to be in BCNF. For a table to be in BCNF, following conditions must be satisfied:  R must be in 3rd Normal Form  and, for each functional dependency ( X → Y ), X should be a super Key. ************************
  • 19. Assistant Professor (GAJENDRA JINAGR) 19 Q.8 Discuss the purpose of BCNF .Describe how BCNF is better than 3NF. Ans: To eliminate these anomalies in 3NF relations, it is necessary to carry out the normalization process to the next higher step, the Boyce-Codd Normal Form. BCNF is simply a stronger definition of 3NF. Since BCNF is higher form of 3NF, so a relation in BCNF must be in 3NF. BCNF makes no explicit reference to first and second normal form as such, nor the concept of full and transitive dependence. BCNF states that: • A relation R is in Boyce/Codd N/F (BCNF) if and only if every determinant is a candidate key. Here, determinant is a simple attribute or composite attribute on which some other attributes is fully functionally dependent. For example: Qty is FFD on (Sno, Pno) (Sno, Pno) --.> Qty, here (Sno, Pno) is a composite determinant. Sno --> Sname Here, Sno is simple attribute determinate. Similarities between 3NF and BCNF The relations which are achieved after application of 3NF can also be achieved by BCNF. For example, relation COURSE_STUDENT and STUDENT_SYSTEM_CHARGE which are not in 3NF are also not in BCNF. COURSE STUDENT (Course _Code, Rollno, Name, System _Used, Hourly _Rate, Total_Hours) Here, (Course_Code, RoIIno) ----+ Total_Hours RoIIno ---> Name I System_Used I Hourly_Rate Here, Rollno is a determinant but not candidate key (candidate key is course_code, Rollno) so relation COURSE_STUDENT is not in BCNF. In relation STUDENT_SYSTEM_CHARGE (Rollno, Name, System _Used, Hourly_Rate) Rollno --> Name I System_Used I Hourly_Rate System_Used --> Hourly_Rate Here, System_Used is also a determinant but it is not unique, so relation STUDENT -SYSTEM -CHARGE is not in BCNF. Now, Consider COURSE, HOUR_ASSIGNED, STUDENT_SYSTEM, CHARGE relations which are in 3NF. COURSE (Course _Code, Course _Name, Teacher_Name) HOUR_ASSIGNED (Course_Code, RoIIno, Total_Hours)
  • 20. Assistant Professor (GAJENDRA JINAGR) 20 STUDENT_SYSTEM (Rollno, Name, System_Used) CHARGE (System _Used, Hourly _Rate) These relations are also in BCNF, because Course_Code --> Course_Name I Teacher_Name (In relation COURSE) (Course _Code, Rollno) --> Total_ Hours (In relation HOUR_ASSIGNED) Rollno --> Name I System_Used (In relation STUDENT_SYSTEM) System_Used --> Hourly_Rate (In relation CHARGES) Here, each determinant is unique in its corresponding relation. In conclusion, we can say that in these relations which have only single candidate key can be normalized both with 3NF and BCNF without any problem. Differences in 3NF and BCNF In order to show the difference between 3NF and BCNF, relations having overlapping of candidate keys are considered in detail. Overlapping of Candidate keys Two candidate keys overlap if they involve two or more attributes each and have an attribute in common. For example, in Manufacturer relation. Manufacturer (Id_no,Name,Item_No,Quantity) Here, Name is considered unique for each Id_No. FD of above relation is (Id_No, Item_No) --> Quantity (Name, Item_No) --> Quantity Id No --> Name Name --> Id_No
  • 21. Assistant Professor (GAJENDRA JINAGR) 21 This relation has two overlapping candidate keys, because there are two composite candidate keys (Id_No, Item_No) and (Name,Item_No) out of which Item_No is common attribute in both the candidate keys, so this is a case of overlapping of candidate keys. Possible FD diagram of this case is: Here, both the relations are in 3NF, because every non-key attribute is non-transitively fully functional dependent on the primary key. In above relation, there is only one non-key attribute i.e. Quantity and it is FFD and non transitively dependent on the primary key. Names, Id_No are not non-key attributes because they can participate into the primary key as shown in FD diagram. But, Manufacturer relation IS not III BCNF because this relation has four determinants (Id-no, Item-No) [Qty depends on this combination] (Name,Item_No) [Qty depends on this combination] Id No [Name depends on Id_No] Name [Id_No depends on Name] Out of these four determinants two determinants (Id_No, Item_No) and (Name,Item_No) are unique but Id_No and Name determinants are not candidate keys. In order to make this relation in BCNF we non-loss decompose this relation in two projections ID_NAME (Id_No, Name) and ID_QTY (Id_No, Item_No, Quantity). ID_NAME relation has two detenninants Id_No, Name and both are unique. ID_QTY has one determinant (Id_No, Item_No) and is also unique. These two relations ID_NAME and ID_QTY removes all anomalies of Manufacturer relation. Another Example For example, consider a relation
  • 22. Assistant Professor (GAJENDRA JINAGR) 22 SSP (Sno, Sname, Pno, Qty) Here, Sname is considered unique for each Sno. FD of above relation is (Sno, Pno) - Qty (Sname, Pno) - Qty Sno - Sname Sname - Sno This relation has two overlapping candidate keys, because there are two composite candidate keys (Sno, Pno) and (Sname, PNo) out of which Pno is common attribute in both the candidate keys, so this is due case of overlapping of candidate keys.Possible FD diagram of this case is: Here, both the relations are in 3NF, because every non-key attribute is non-transitively fully functional dependent on the primary key. In above relation, there is only one non-key attribute i.e. Qty and it is FFD and non transitively dependent on the primary key. Sname, Sno are not non-key attributes because they can participate into the primary key as shown in FD diagram. But, SSP relation is not in BCNF because this relation has four determinants: (Sno, Pno) (Sname, Pno) (Sno) (Sname) Out of these four determinants two determinants (Sno, Pno) and (Sname, Pno) are unique but Sno and Sname determinants are not candidate keys. In order to make this relation in BCNF we non-loss decompose this relation in two projections SN (Sno, Sname) and SP (Sno, Pno, Qty).
  • 23. Assistant Professor (GAJENDRA JINAGR) 23 SN relation has two determinants Sno, Sname and both are unique. SP has one determinant (Sno, Pno) and is also unique. These two relations (SN, SP) remove all anomalies of SSP relation. Another Case: Consider a relation SST with attributes (Student, Subject, Teacher). There 'are following rules applied on above relation: • For each subject, each student of that subject is taught by only one teacher • Each teacher teaches only one subject • Each subject is taught by several teachers Table shows a sample data: FD's of above relation are According to condition 1: Subject, Student combination gives only one teacher (Subject, Student) --- Teacher According to, condition 2 Each teacher teaches only one subject Teacher --- Subject Since, each teacher teaches only one subject, so a student can taught one subject by only one teacher. In other words, the combination of teacher and student can "also determine subject. (Teacher, Student)--- Subject Once again the relation is in 3NF,but not in BCNF. This relation has following FDs: (Subject, Student) --- Teacher Teacher --- Subject
  • 24. Assistant Professor (GAJENDRA JINAGR) 24 (Teacher, Student) --- Subject This is a case of overlapping of candidate keys, because there are two composite candidate keys (Subject, Student) and (Teacher, Student) and Student is a common attribute in both the candidate keys. So, this database must be normalized according the BCNF. This relation suffers again from the anomalies as discussed below: For example, if we wish to delete the information that Kumar is study Physics, we cannot do so without losing the information that Prof. Neha teaches Physics. These difficulties are caused by the fact that teacher is determinant but not a candidate key. In order to make it in BCNF, teacher must be candidate key, so original relation is replaced by two projections ST (Student, Teacher) and TJ (Teacher, Subject). All the anomalies which were present in SST, now removed in these two relations. Practice Session: Show that every two-attribute relation is in BCNF. That is, if r(X, Y) then r(X,Y) is in BCNF. Solution: Let us consider the following cases: a) X is the sole key of the relation. In this case, the nontrivial dependency X---> Y has X as a super key since X c Y. b) Y is the sole key of the relation. hi this case, the nontrivial dependency Y-->X has Y as a super key since Y c Y. c) Both X --> Y and Y --> X hold simultaneously. Then whatever PK we consider for the relation we will have either X or Y as its determinant. Either one of the two possible cases has already been considered under (a) or (b). Consider the relation Supplier (Supplier-No, Part-No. Supplier-Name, Supplier- Control, Price) and assume that only the following FDs hold for this relation: Supplier-No --- >Supplier-Name, Supplier-No ~ Supplier-Control. What type of data anomalies does this relation have in its present form? Transform it to 3NF if not already in that form. Solution: This relation present insertion anomalies, deletion anomalies and update anomalies. In this relation we cannot enter a Supplier-Control until that supplier supplies a part (insertion anomaly). Notice that this is necessary to preserve the integrity constraint of the key. If a supplier stops temporarily supplying a particular part, then the deletion of the last tuple containing that Supplier-No also deletes the Supplier-Control of the supplier (deletion anomaly). Finally, if the Supplier-Control of a particular supplier needs to be updated, we must look for every tuple that contains that supplier as part of the key. If a supplier supplies many parts and we fail to update all the corresponding tuple, the database may end up in an inconsistent state. We can transform this relation into a 2NF as follows: Supplier (Supplier-No, Supplier-Name, Supplier-Control) and Part (Part-No, Supplier-No, Price)
  • 25. Assistant Professor (GAJENDRA JINAGR) 25 Consider the relation for release RECORD (Title, Performer, Style, Price, Label, Producer) and the dependencies shown below. Indicate what the highest normal form of this relation is. Indicate a possible 3NF decomposition of this relation. Title --> Label, Style Style --> Price Performer --> Producer Solution: The key of the relation is the composite attribute Title, Performer. As it stands the relation is in INF because there is at least one partial dependency on the key. For example, Performer - Producer. A possible decomposition may be Record (Title, Performer), Genre (Title, Label, Style), Producer (Performer, Producer- Name), Cost(Style, Price).