Sie sind auf Seite 1von 7

FALL 2013 ASSIGNMENT

SEMESTER III
SUBJECT CODE & NAME BCA3020 & DBMS
Q. No. 1 Differentiate between physical data independence and logical data independence.
ANSWER:
One of the biggest advantages of database is data independence. It means we can change the conceptual schema at
one level without affecting the data at other level. It means we can change the structure of a database without
affecting the data required by users and program. This feature was not available in file oriented approach. There are
two types of data independence and they are:
1. Physical data independence
2. Logical data independence

Data Independence The ability to modify schema definition in on level without affecting schema definition in the
next higher level is called data independence. There are two levels of data independence:
1. Physical data independence is the ability to modify the physical schema without causing application programs to
be rewritten. Modifications at the physical level are occasionally necessary to improve performance. It means we
change the physical storage/level without affecting the conceptual or external view of the data. The new changes are
absorbed by mapping techniques.
2. Logical data independence in the ability to modify the logical schema without causing application program to be
rewritten. Modifications at the logical level are necessary whenever the logical structure of the database is altered (for
example, when money-market accounts are added to banking system).
Logical Data independence means if we add some new columns or remove some columns from table then the user
view and programs should not changes. It is called the logical independence. For example: consider two users A & B.
Both are selecting the empno and ename. If user B add a new column salary in his view/table then it will not effect the
external view user; user A, but internal view of database has been changed for both users A & B. Now user A can also
print the salary.
It means if we change in view then program which use this view need not to be changed.
Logical data independence is more difficult to achieve than is physical data independence, since application
programs are heavily dependent on the logical structure of the data that they access.
Logical data independence means we change the physical storage/level without effecting the conceptual or
external view of the data. Mapping techniques absorbs the new changes.

Q2 List different file organizations. Explain about Sequential File Organization

ANSWER:
File organization refers to the way records are physically arranged on a storage device. This topic describes the two
main types of file organization.
Related topics describe the following:
Record type refers to whether records in a file are all the same length, are of varying length, or use other conventions
to define where one record ends and another begins. For more information on record types, see Record Types.
Record access refers to the method used to read records from or write records to a file, regardless of its organization.
The way a file is organized does not necessarily imply the way in which the records within that file will be accessed.
For more information on record access, see File Access and File Structure and Record Access.
Types of File Organization
Fortran supports two types of file organizations:
Sequential
Relative
The organization of a file is specified by means of the ORGANIZATION keyword in the OPEN statement.
The default file organization is always ORGANIZATION= 'SEQUENTIAL' for an OPEN statement.
You can store sequential files on magnetic tape or disk devices, and can use other peripheral devices, such as
terminals, pipes, and line printers as sequential files.
You must store relative files on a disk device.
Sequential File Organization
A sequentially organized file consists of records arranged in the sequence in which they are written to the file (the first
record written is the first record in the file, the second record written is the second record in the file, and so on). As a
result, records can be added only at the end of the file. Attempting to add records at some place other than the end of
the file will result in the file begin truncated at the end of the record just written.
Sequential files are usually read sequentially, starting with the first record in the file. Sequential files with a fixedlength record type that are stored on disk can also be accessed by relative record number (direct access).

3 What is View? With an example, use the format of view statement to create view
Answer:
Views are virtual tables formed by a query. A view is a dictionary object that you can use until you drop it. Views are
not updatable.
If a qualified view name is specified, the schema name cannot begin with SYS.
A view operates with the privileges of the owner of the view. See "Using SQL standard authorization" and "Privileges
on views, triggers, and constraints" in the Java DB Developer's Guide for details.

The view owner automatically gains the SELECT privilege on the view. The SELECT privilege cannot be revoked from
the view owner. The database owner automatically gains the SELECT privilege on the view and is able to grant this
privilege to other users. The SELECT privilege cannot be revoked from the database owner.
The view owner can only grant the SELECT privilege to other users if the view owner also owns the underlying
objects.
If the underlying objects that the view references are not owned by the view owner, the view owner must be granted
the appropriate privileges. For example, if the authorization ID user2 attempts to create a view calleduser2.v2 that
references table user1.t1 and function user1.f_abs(), then user2 must have the SELECT privilege on table user1.t1 and
the EXECUTE privilege on function user1.f_abs().
The privilege to grant the SELECT privilege cannot be revoked. If a required privilege on one of the underlying objects
that the view references is revoked, then the view is dropped.
Syntax
CREATE VIEW view-Name
[ ( Simple-column-Name [, Simple-column-Name] * ) ]
AS Query [ ORDER BY clause ]
[ result offset clause ]
[ fetch first clause ]
A view definition can contain an optional view column list to explicitly name the columns in the view. If there is no
column list, the view inherits the column names from the underlying query. All columns in a view must be uniquely
named.
Examples
CREATE VIEW SAMP.V1 (COL_SUM, COL_DIFF)
AS SELECT COMM + BONUS, COMM - BONUS
FROM SAMP.EMPLOYEE;
CREATE VIEW SAMP.VEMP_RES (RESUME)
AS VALUES 'Delores M. Quintana', 'Heather A. Nicholls', 'Bruce Adamson';
CREATE VIEW SAMP.PROJ_COMBO
(PROJNO, PRENDATE, PRSTAFF, MAJPROJ)
AS SELECT PROJNO, PRENDATE, PRSTAFF, MAJPROJ
FROM SAMP.PROJECT UNION ALL
SELECT PROJNO, EMSTDATE, EMPTIME, EMPNO
FROM SAMP.EMP_ACT
WHERE EMPNO IS NOT NULL;
Statement dependency system
View definitions are dependent on the tables and views referenced within the view definition. DML (data
manipulation language) statements that contain view references depend on those views, as well as the objects in the
view definitions that the views are dependent on. Statements that reference the view depend on indexes the view uses;
which index a view uses can change from statement to statement based on how the query is optimized. For example,
given:
CREATE TABLE T1 (C1 DOUBLE PRECISION);
CREATE FUNCTION SIN (DATA DOUBLE)
RETURNS DOUBLE EXTERNAL NAME 'java.lang.Math.sin'
LANGUAGE JAVA PARAMETER STYLE JAVA;

CREATE VIEW V1 (C1) AS SELECT SIN(C1) FROM T1;


the following SELECT:
SELECT * FROM V1
is dependent on view V1, table T1, and external scalar function SIN.

4 Define the terms:


a) 3NF
ANSWER: The third normal form (3NF) is a normal form used in database normalization. 3NF was originally
defined by E.F. Codd in 1971. Codd's definition states that a table is in 3NF if and only if both of the following
conditions hold:

The relation R (table) is in second normal form (2NF)

Every non-prime attribute of R is non-transitively dependent (i.e. directly dependent) on every superkey of
R.

A non-prime attribute of R is an attribute that does not belong to any candidate key of R. A transitive
dependency is a functional dependency in which X Z (X determines Z) indirectly, by virtue
of X Y and Y Z (where it is not the case that Y X).
A 3NF definition that is equivalent to Codd's, but expressed differently, was given by Carlo Zaniolo in 1982. This
definition states that a table is in 3NF if and only if, for each of its functional dependencies X A, at least one of
the following conditions holds:

X contains A (that is, X A is trivial functional dependency), or

X is a superkey, or

Every element of A-X, the set difference between A and X, is a prime attribute (i.e., each attribute in AX is contained in some candidate key)

Zaniolo's definition gives a clear sense of the difference between 3NF and the more stringent BoyceCodd normal
form (BCNF). BCNF simply eliminates the third alternative ("Every element of A-X, the set difference between A and
X, is a prime attribute").
The next step is to transform the data in second normal form (2NF) into third normal form (3NF). The rule
is: remove to a new table any non-key attributes that are more dependent on other non-key attributes
than the table key. Ignore tables with zero or only one non-key attribute (these go straight to 3NF with no
conversion). The process is as follows:

If a non-key attribute is more dependent on another non-key attribute than the table key:
o

Move the dependent attribute, together with a copy of the non-key attribute upon which it is
dependent, to a new table.

Make the non-key attribute, upon which it is dependent, the key in the new table. Underline the key
in this new table.

Leave the non-key attribute, upon which it is dependent, in the original table and mark it
a foreign key (*).

b) BCNF
ANSWER:
Boyce-Codd Normal Form (BCNF)

When a relation has more than one candidate key, anomalies may result even though the relation is in 3NF.

3NF does not deal satisfactorily with the case of a relation with overlapping candidate keys

i.e. composite candidate keys with at least one attribute in common.

BCNF is based on the concept of a determinant.

A determinant is any attribute (simple or composite) on which some other attribute is fully functionally
dependent.

A relation is in BCNF is, and only if, every determinant is a candidate key.

Consider the following relation and determinants.


R(a,b,c,d)
a,c -> b,d
a,d -> b
Here, the first determinant suggests that the primary key of R could be changed from a,b to a,c. If this change was
done all of the non-key attributes present in R could still be determined, and therefore this change is legal. However,
the second determinant indicates that a,d determines b, but a,d could not be the key of R as a,d does not determine all
of the non key attributes of R (it does not determine c). We would say that the first determinate is a candidate key, but
the second determinant is not a candidate key, and thus this relation is not in BCNF (but is in 3 rd normal form).

5 What are the Advantages and disadvantages of Data Distribution


ANSWER:
In a distributed database, data is stored in different systems across a network. For Example, in mainframes, personal
computers, laptops, cell phones, etc.
Advantages of distributed database:
1) In a distributed database, data can be stored in different systems like personal computers, servers, mainframes, etc.

2) A user doesnt know where the data is located physically. Database presents the data to the user as if it were located
locally.
3) Database can be accessed over different networks.
4) Data can be joined and updated from different tables which are located on different machines.
5) Even if a system fails the integrity of the distributed database is maintained.
6) A distributed database is secure.
Disadvantages of distributed database:
1) Since the data is accessed from a remote system, performance is reduced.
2) Static SQL cannot be used.
3) Network traffic is increased in a distributed database.
4) Database optimization is difficult in a distributed database.
5) Different data formats are used in different systems.
6) Different DBMS products are used in different systems which increases in complexity of the system.
7) Managing system catalog is a difficult task.
8) While recovering a failed system, the DBMS has to make sure that the recovered system is consistent with other
systems.
9) Managing distributed deadlock is a difficult task.

6 Differentiate Relational Database Management System and Object Oriented Database Management
System
ANSWER:
"In an object oriented database, information is represented in the form of objects as used in Object-Oriented
Programming. When database capabilities are combined with object programming language capabilities, the result is
an object database management system (ODBMS). An ODBMS makes database objects appear as programming
language objects in one or more object programming languages. An ODBMS extends the programming language with
transparently persistent data, concurrency control, data recovery, associative queries, and other capabilities.
Some object-oriented databases are designed to work well with object-oriented programming languages such as
Python, Java, C#, Visual Basic .NET, C++ and Smalltalk. Others have their own programming languages. ODBMSs
use exactly the same model as object-oriented programming languages.
Object databases are generally recommended when there is a business need for high performance processing on
complex data."

"An object-relational database (ORD) or object-relational database management system (ORDBMS) is a relational
database management system that allows developers to integrate the database with their own custom data types and
methods. The term object-relational database is sometimes used to describe external software products running over
traditional DBMSs to provide similar features; these systems are more correctly referred to as object-relational
mapping systems.
Whereas RDBMS or SQL-DBMS products focused on the efficient management of data drawn from a limited set of
data types (defined by the relevant language standards), an object-relational DBMS allows software developers to
integrate their own types and the methods that apply to them into the DBMS. The goal of ORDBMS technology is to
allow developers to raise the level of abstraction at which they view the problem domain."

Das könnte Ihnen auch gefallen