Dbms Objective Bits PDF
Dbms Objective Bits PDF
com
www.jwjobs.net
DC10
PART-I
Q.2
Relational calculus is a
(A) Procedural language.
(C) Data definition language.
Ans: B
Q.3
Ans: A
Q.4
Q.5
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.6
Q.8
Q.9
Q.10
(B) DML
(D) DCL
Ans: C
Q.11
Q.12
An entity set that does not have sufficient attributes to form a primary key is a
(A) strong entity set.
(B) weak entity set.
(C) simple entity set.
(D) primary entity set.
Ans: B
Q.13
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.14
Q.15
Q.16
Q.17
The language used in application programs to request data from the DBMS is referred
to as the
(A) DML
(B) DDL
(C) VDL
(D) SDL
Ans: A
Q.18
A logical schema
(A) is the entire database.
(B) is a standard way of organizing information into accessible parts.
(C) describes how data is actually stored on disk.
(D) both (A) and (C)
Ans: A
Q.19
Q.20
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.21
Q.22
The way a particular application views the data from the database that the application
uses is a
(A) module.
(B) relational model.
(C) schema.
(D) sub schema.
Ans: D
Q.23
Q.24
Ans: B
Q.25
Q.26
Q.27
Q.28
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Ans: B
Q.29
Conceptual design
(A) is a documentation technique.
(B) needs data volume and processing frequencies to determine the size of the database.
(C) involves modelling independent of the DBMS.
(D) is designing the relational model.
Ans:C
Q.30
The method in which records are physically stored in a specified order according to a key
field in each record is
(A) hash.
(B) direct.
(C) sequential.
(D) all of the above.
Ans: A A method in which records are physically stored in a specified order according
to a key field in each record is hash.
(In hash method, a hash function is performed on the key value to determine the
unique physical address of the record to store or retrieve)
Q.31
A subschema expresses
(A) the logical view.
(C) the external view.
Q.33
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.34
Q.35
Q.36
Q.37
Q.38
Q.39
Q.40
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.41
Q.42
Q.43
Relational Algebra is
(A) Data Definition Language .
(B) Meta Language
(C) Procedural query Language
(D) None of the above
Ans: C
Q.44
Q.45
Q.46
The file organization that provides very fast access to any arbitrary record of a file is
(A) Ordered file
(B) Unordered file
(C) Hashed file
(D) B-tree
Ans: C
Q.47
Ans: D
Q.48
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.49
(D) Switchboards
In a relation
(A) Ordering of rows is immaterial
(B) No two rows are identical
(C) (A) and (B) both are true
(D) None of these.
Ans: C
Q.50
Q.51
Q.52
Ans: D
Q.53
Q.54
Which of the following operation is used if we are interested in only certain columns of a
table?
(A) PROJECTION
(B) SELECTION
(C) UNION
(D) JOIN
Ans: A
8
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.55
Q.56
Q.57
Which of the following operations need the participating relations to be union compatible?
(A) UNION
(B) INTERSECTION
(C) DIFFERENCE
(D) All of the above
Ans: D
Q.58
Ans: C
Q.59
Q.60
Q.61
Q.62
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.63
Q.64
The result of the UNION operation between R1 and R2 is a relation that includes
(A) all the tuples of R1
(B) all the tuples of R2
(C) all the tuples of R1 and R2
(D) all the tuples of R1 and R2 which have common columns
Ans: D
Q.65
Q.66
Q.67
Which of the operations constitute a basic set of operations for manipulating relational
data?
(A) Predicate calculus
(B) Relational calculus
(C) Relational algebra
(D) None of the above
Ans:C
Q.68
Q.69
Q.70
NULL is
(A) the same as 0 for integer
(B) the same as blank for character
(C) the same as 0 for integer and blank for character
10
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.71
Q.72
Q.73
A file manipulation command that extracts some of the records from a file is called
(A) SELECT
(B) PROJECT
(C) JOIN
(D) PRODUCT
Ans: A
Q.74
Q.75
Using Relational Algebra the query that finds customers, who have a balance of over
1000 is
(A) Customer_name( balance >1000(Deposit))
(B) Customer_name( balance >1000(Deposit))
(C) Customer_name( balance >1000(Borrow))
(D) Customer_name( balance >1000(Borrow))
Ans: A
Q.76
Q.77
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Ans B
Q.78
Cross Product is a:
(A) Unary Operator
(C) Binary Operator
Ans: C
Q.79
Q.80
Consider the join of a relation R with relation S. If R has m tuples and S has n tuples,
then the maximum size of join is:
(A) mn
(B) m+n
(C) (m+n)/2
(D) 2(m+n)
Ans: A
Q.81
Q.82
Q.83
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.84
Q.85
Ans: A
Q.86
Q.87
The ______ operator is used to compare a value to a list of literals values that have been
specified.
(A) BETWEEN
(B) ANY
(C) IN
(D) ALL
Ans: A
Q.88
A logical schema
A) is the entire database
B) is a standard way of organizing information into a accessible part
C) describe how data is actually stored on disk
D) none of these
Ans: D
Q.89
Q.90
_____________ function divides one numeric expression by another and returns the
remainder.
(A) POWER
(B) MOD
(C) ROUND
(D) REMAINDER
Ans: B
Q.91
A data manipulation command the combines the records from one or more tables is called
(A) SELECT
(B) PROJECT
(C) JOIN
(D) PRODUCT
13
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.92
Q.93
_________ is a virtual table that draws its data from the result of an SQL
SELECT statement.
(A) View
(B) Synonym
(C) Sequence
(D) Transaction
Ans: A
Q.94
Q.95
Ans: B
Q.96
Q.97
14
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
PART-II
DESCRIPTIVES
Q.1
What is a database? Describe the advantages and disadvantages of using of DBMS. (7)
Ans: Database A database is a collection of related data and/or information stored so
that it is available to many users for different purposes.
Advantages Of DBMS
1.
Centralized Management and Control - One of the main advantages of using a
database system is that the organization can exert, via the DBA, centralized
management and control over the data.
2.
Reduction of Redundancies and Inconsistencies - Centralized control avoids
unnecessary duplication of data and effectively reduces the total amount of data
storage required. Removing redundancy eliminates inconsistencies.
3.
Data Sharing - A database allows the sharing of data under its control by any
number of application programs or users.
4.
Data Integrity - Data integrity means that the data contained in the database is both
accurate and consistent. Centralized control can also ensure that adequate checks are
incorporated in the DBMS to provide data integrity.
5.
Data Security - Data is of vital importance to an organization and may be
confidential. Such confidential data must not be accessed by unauthorized persons.
The DBA who has the ultimate responsibility for the data in the DBMS can ensure
that proper access procedures are followed. Different levels of security could be
implemented for various types of data and operations.
6.
Data Independence - Data independence is the capacity to change the schema at
one level of a database system without having to change the schema at the next
level. It is usually considered from two points of view: physical data independence
and logical data independence. Physical data independence is the capacity to change
the internal schema without having to change conceptual schema. Logical data
independence is the capacity to change the conceptual schema without having to
change external schemas or application programs.
7.
Providing Storage Structures for Efficient Query Processing - Database systems
provide capabilities for efficiently executing queries and updates. Auxiliary files
called indexes are used for this purpose.
8.
Backup and Recovery - These facilities are provided to recover databases from
hardware and/or software failures.
Some other advantages are:
Reduced Application Development Time
Flexibility
Availability of up-to-date Information
Disadvantages Of DBMS
1.
Cost of Software/Hardware and Migration - A significant disadvantage of the
DBMS system is cost.
15
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
3.
Q.2
(7)
Ans:
1. DBA administers the three levels of the database and, in consultation with the
overall user community, sets up the definition of the global view or conceptual level
of the database.
2. Mappings between the internal and the conceptual levels, as well as between the
conceptual and external levels, are also defined by the DBA.
3. DBA ensures that appropriate measures are in place to maintain the integrity of the
database and that the database is not accessible to unauthorized users.
4. DBA is responsible for granting permission to the users of the database and stores
the profile of each user in the database.
5. DBA is responsible for defining procedures to recover the database from failures
with minimal loss of data.
Q.3
Explain the terms primary key, candidate key and foreign key. Give an example for
each.
(7)
Ans:
Primary Key Primary key is one of the candidate keys that uniquely
identifies each row in the relation.
Candidate Key A candidate key of an entity set is a minimal superkey, that uniquely
identifies each row in the relation.
Foreign Key Let there are two relations (tables) R and S. Any candidate key of the
relation R which is referred in the relation S is called the foreign key in the relation S and
referenced key in the relation R. The relation R is also called as parent table and relation S
is also called as child table.
For example:
STUDENT
Enrl No
11
15
6
33
Roll No
17
16
6
75
Name
Ankit Vats
Vivek Rajput
Vanita
Bhavya
City
Delhi
Meerut
Punjab
Delhi
16
www.jntuworld.com
Mobile
9891663808
9891468487
9810618396
www.jntuworld.com
www.jwjobs.net
DC10
Q.4
Differentiate between logical database design and physical database design. Show how
this separation leads to data independence.
(7)
Ans:
Basis
Task
Choice of The mapping can proceed in two The following criteria are often used
criteria
stages:
to guide the choice of physical
database design options:
System-independent
mapping
Response Time
but data model-dependent
Tailoring the schemas to a Space Utilization
specific DBMS
Transaction Throughput
Result
DDL statements in the language of An initial determination of storage
the chosen DBMS that specify the structures and the access paths for
conceptual and external level the database files. This corresponds
schemas of the database system. But to defining the internal schema in
if the DDL statements include some terms of Data Storage Definition
physical design parameters, a Language.
complete DDL specification must
wait until after the physical
database design phase is completed.
The database design is divided into several phases. The logical database design and
physical database design are two of them. This separation is generally based on the
concept of three-level architecture of DBMS, which provides the data independence.
Therefore, we can say that this separation leads to data independence because the output
of the logical database design is the conceptual and external level schemas of the database
17
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.5
Q.6
What is ODBC? How does Oracle act as ODBC and give examples of front end uses with
ODBC.
(7)
Ans:
ODBC Open DataBase Connectivity (ODBC) enable the integration of SQL with a
general-purpose programming language. ODBC expose database capabilities in a
standardized way to the application programmer through an application programming
interface (API). Using ODBC, an application can access not just one DBMS but several
different ones simultaneously.
ODBC achieve portability at the level of the executable by introducing an extra level of
indirection. All direct interaction with a specific DBMS happens through a DBMSspecific driver. A driver is a software program that translates the ODBC calls into DBMSspecific calls. Drivers are loaded dynamically on demand since the DBMSs the
application is going to access are known only at run-time. Available drivers are registered
with a driver manager. The Oracle database driver translates the SQL commands from the
application into equivalent commands that the Oracle DBMS understands and takes the
result from the DBMS and translate into equivalent form for the application.
Example: Let there be a DSN named EMPLOYEE through, which we want to access the
Oracle database in Visual Basic.
Dim CN As New ADODB.Connection
Dim RS As New ADODB.Recordset
CN.Open DSN=employee, scott, tiger
18
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.7
Define the five basic operators of relational algebra with an example each.
(7)
Q:
ID
Name
ID
Name
101
Jones
100
John
103
Smith
104
Lalonde
104
Lalonde
R=PQ
R=PQ
ID
Name
ID
Name
100
John
101
Jones
101
Jones
103
Smith
103
Smith
104
Lalonde
R=PQ
P.ID
P.Name
Q.ID
Q.Name
101
Jones
100
John
101
Jones
104
Lalonde
103
Smith
100
John
103
Smith
104
Lalonde
104
Lalonde
100
John
104
Lalonde
104
Lalonde
19
www.jntuworld.com
www.jntuworld.com
DC10
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
4. Projection (
) - The projection of a relation is defined as a projection of all its tuples
over some set of attributes, i.e., it yields a vertical subset of the relation. It is used to
either reduce the number of attributes (degree) in the resultant relation or to reorder
attributes. The projection of a relation T on the attribute A is denoted by A(T).
5. Selection (
) - Selects only some of the tuples, those satisfy given criteria, from the
relation. It yields a horizontal subset of a given relation, i.e., the action is defined over a
complete set of attribute names but only a subset of the tuples are included in the result.
R = B(P)
For Example:
EMPLOYEE:
Id
Name
Name
101
Jones
Jones
103
Smith
Smith
104
106
Lalonde
Lalonde
Byron
Byron
Smith
104
Lalonde
Byron
106
106
Byron
Explain entity integrity and referential integrity rules in relational model. Show how
these are realized in SQL.
(7)
Ans:
Entity Integrity Rule No primary key value can be null.
Referential Integrity Rule In referential integrity, it is ensured that a value that appears
in one relation for a given set of attributes also appears for a certain set of attributes in
another relation.
In SQL, entity integrity and referential integrity rules are implemented as constraints on
the relation called as primary key constraint and reference key constraint respectively.
These constraints can be specified with relation at the time of creation of the relations or
after the creation of the relations by altering the definition of the relations. For example:
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.9
VARCHAR2(15),
VARCHAR2(10),
NUMBER REFERENCES DEPT(DEPTNO));
What are the advantages of embedded query language? Give an example of a embedded
SQL query.
(7)
Ans:
Embedded query language 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);
Q.10
Q.11
Define a view and a trigger. Construct a view for the above relations which has the
information about suppliers and the parts they supply. The view contains the S#,
SNAME, P# , PNAME renamed as SNO, NAME, PNO, PNAME.
(7)
21
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
(10)
Ans:(i) Theta Join The theta join operation is an extension to the natural-join
operation that allows us to combine selection and a Cartesian product into a single
operation. Consider relations r(R) and s(S), and let be a predicate on attributes in the
schema R S. The theta join operation r s is defined as follows:
r s = (r x s)
(ii) Equi Join It produces all the combinations of tuples from two relations that
satisfy a join condition with only equality comparison (=).
(iii)
Natural Join - Same as equi-join except that the join attributes (having same
names) are not included in the resulting relation. Only one sets of domain compatible
attributes involved in the natural join are present.
(iv) Outer Join - If there are any values in one table that do not have corresponding
value(s) in the other, in an equi-join that will not be selected. Such rows can be forcefully
selected by using the outer join. The corresponding columns for that row will have
NULLs. There are actually three forms of the outer-join operation: left outer join ( X),
right outer join (X ) and full outer join ( X ).
Q.13
What are temporary tables? When are they useful? Justify with an example.
(4)
Ans:
Temporary tables exists solely for a particular session, or whose data persists for the
duration of the transaction. The temporary tables are generally used to support specialized
rollups or specific application processing requirements. Unlike a permanent table, a space
is not allocated to a temporary table when it is created. Space will be dynamically
allocated for the table as rows are inserted. The CREATE GLOBAL TEMPORARY
TABLE command is used to create a temporary table in Oracle.
CREATE GLOBAL TEMPORARY TABLE <table_name> (
22
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.14
(7)
Ans:
A DBMS provides three levels of data is said to follow three-level architecture. The goal
of the three-schema architecture is to separate the user applications and the physical
database. The view at each of these levels is described by a schema. The processes of
transforming requests and results between levels are called mappings. In this architecture,
schemas can be defined at the following three levels:
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.15
Ans:
Heap File is an unordered set of records, stored on a set of pages. This class
provides basic support for inserting, selecting, updating, and deleting records. Temporary
heap files are used for external sorting and in other relational operators. A sequential scan
of a heap file (via the Scan class) is the most basic access method.
Sorted file The sort utility shall perform one of the following functions:
1.Sort lines of all the named files together and write the result to the specified output.
2.Merge lines of all the named (presorted) files together and write the result to the specified
output.
3.Check that a single input file is correctly presorted.
Comparisons shall be based on one or more sort keys extracted from each line of input
(or, if no sort keys are specified, the entire line up to, but not including, the terminating
<newline>), and shall be performed using the collating sequence of the current locale.
Q.16
Describe a method for direct search? Explain how data is stored in a file so that direct
searching can be performed.
Ans:
For a file of unordered fixed length records using unspanned blocks and
contiguous allocation, it is straight forward to access any record by its position in the file.
If the file records are numbered 0,1,2,---,r-1 and the records in each block are numbered
0,1,---bfr-1; where bfr is the blocking factor, then ith record of the file is located in block
[(i/bfr)] and is the (I mod bfr)th record in that block. Such a file is often called a relative or
direct file because records can easily be accessed directly by their relative positions.
Accessing a record based on a search condition; however, it facilitates the construction of
access paths on the file, such as the indexes.
Q17
Explain the integrity constraints: Not Null, Unique, Primary Key with an example each.
Is the combination Not Null, Primary Key a valid combination. Justify.
(7)
Ans: Not Null Should contain valid values and cannot be NULL.
Unique An attribute or a combination of two or more attributes must have a unique
value in each row. The unique key can have NULL values.
24
www.jntuworld.com
www.jntuworld.com
DC10
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
Primary Key It is same as unique key but cannot have NULL values. A table can have
at most one primary key in it.
For example:
STUDENT
Roll No Name
17
Ankit Vats
16
Vivek Rajput
6
Vanita
75
Bhavya
Roll No is a primary key.
City
Delhi
Meerut
Punjab
Delhi
Mobile
9891663808
9891468487
NULL
9810618396
Name is defined with NOT NULL, means each student must have a name.
Mobile is unique.
Not Null, Primary Key is a valid combination. Primary key constraint already includes
Not Null constraint in it but we can also add Not Null constraint with it. The use of
Not Null with Primary Key will not have any effect. It is same as if we are using just
Primary Key.
Q.18
(14)
Ans: (i) Nested Queries A SELECT query can have subquery(s) in it. When a
SELECT query having another SELECT query in it, is called as nested query. Some
operations cannot be performed with single SELECT command or with join operation.
There are some operations which can be performed with the help of nested queries (also
referred to as subqueries). For example, we want to compute the second highest salary:
SELECT MAX(SAL) FROM EMP WHERE SAL < (SELECT MAX(SAL) FROM EMP)
Some operations can be performed both by Join and subqueries. The Join operation is
costlier in terms of time and space. Therefore, the solution based on subqueries is
preferred.
(ii) Cursors in SQL An object used to store the output of a query for row-by-row
processing by the application programs. Cursors are constructs that enable the user to
name a private memory area to hold a specific statement for access at a later time.
Cursors are used to process multi-row result sets one row at a time. Additionally, cursors
keep track of which row is currently being accessed, which allows for interactive
processing of the active set.
(iii) RDBMS RDBMS is a database management system (DBMS) that stores data in
the form of relations. Relational databases are powerful because they require few
assumptions about how data is related or how it will be extracted from the database. As a
result, the same database can be viewed in many different ways. An important feature of
25
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.19
Q.20
What is a key? Explain Candidate Key, Alternate Key and Foreign Key.
(7)
Ans:
Key A single attribute or a combination of two or more attributes of an entity set that is
used to identify one or more instances (rows) of the set (table) is called as key.
Candidate Key A candidate key is a minimal superkey, which can be used to uniquely
identify a tuple in the relation.
Alternate Key All the candidate keys except primary key are called as alternate keys.
Foreign Key Let there are two relations (tables) R and S. Any candidate key of the
relation R which is referred in the relation S is called the foreign key in the relation S and
referenced key in the relation R. The relation R is also called as parent table and relation S
is also called as child table.
Q.21
What is data independence? Explain the difference between physical and logical data
independence.
(7)
Ans: Data independence is the capacity to change the schema at one level of a database
system without having to change the schema at the next level. The three-schema
architecture allows the feature of data independence. Data independence occurs
26
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.22
(4 x 4 = 16 )
Ans: (i)
Weak and Strong entity sets: A strong entity set has a primary key. All
tuples in the set are distinguishable by that key. A weak entity set has no primary key
unless attributes of the strong entity set on which it depends are included. Tuples in a
weak entity set are partitioned according to their relationship with tuples in a strong entity
set. Tuples within each partition are distinguishable by a discriminator, which is a set of
attributes. A strong entity set has a primary key. All tuples in the set are distinguishable
by that key. A weak entity set has no primary key unless attributes of the strong entity set
on which it depends are included. Tuples in a weak entity set are partitioned according to
their relationship with tuples in a strong entity set. Tuples within each partition are
distinguishable by a discriminator, which is a set of attributes.
(ii) Types of attributes:An attribute's type determines the kind of values that are allowed
in the attribute. For example, the value version 1 is not valid for an attribute defined as an
integer, but the value 1 is valid. Numeric types (such as integer or real) can also be
limited to a predefined range by their attribute definition.
Choice :An attribute with a list of predefined values.
ID Reference: An attribute with a value that is a Unique ID value from another element.
It is typically used for element-based cross-references.
ID References: An attribute with a value of one or more Unique ID values from
another element.
Integer: An attribute with a whole number value (no decimal parts). Examples of valid
integers are 22, -22, and +322. An integer can be defined to fall within a range.
Integers: An attribute with a value of one or more integers. Enter each number on a
separate line in the Attribute Value text box.
Real An attribute with a real number value, with or without a decimal part (the value
can also be expressed in scientific notation). Examples of valid real numbers are 2, 22.4, 0.22, and 2.3e-1. A real number can be defined to fall within a range.
27
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.23
(5)
Ans:
CREATE TABLE EMPLOYEE
( EMPLOYEE_NAME
VARCHAR2(20) PRIMARY KEY,
STREET
VARCHAR2(20),
CITY
VARCHAR2(15));
CREATE TABLE COMPANY
( COMPANY_NAME
VARCHAR2(50) PRIMARY KEY,
CITY
VARCHAR2(15));
CREATE TABLE WORKS
( EMPLOYEE_NAME
VARCHAR2(20)
REFERENCES EMPLOYEE(EMPLOYEE_NAME,
COMPANYNAME
VARCHAR2(50)
REFERENCES COMPANY(COMPANY_NAME,
SALARY
NUMBER(6),
CONSTRAINT WORKS_PK PRIMARY KEY(EMPLOYEE_NAME,
COMPANY_NAME));
Q.24
www.jntuworld.com
(9)
www.jntuworld.com
www.jwjobs.net
DC10
Q.25 Discuss the correspondence between the E-R model construct and the relation model construct.
Show how each E-R model construct can be mapped to the relational model using the
suitable example?
Ans:
An entity-relationship model (ERM): An entity-relationship model (ERM) is
an abstract conceptual representation of structured data. Entity-relationship modeling is a
relational schema database modeling method, used in software engineering to produce a
type of conceptual data model (or semantic data model) of a system, often a relational
database, and its requirements in a top-down fashion. Diagrams created using this process
are called entity-relationship diagrams, or ER diagrams or ERDs for short.
ER-to-Relational Mapping Algorithm:
1) Step 1: Mapping of regular entity types: For each strong entity type E, create a
relation T that includes all the simple attributes of a composite attribute.
2) Step2: Mapping of weak entity types: For each weak entity type W with owner entity
type E, create relation R and include all simple attributes (or simple components of
composite attributes) of W as attributed of R. In addition, include as foreign key attributes
of R, the primary key attribute (s) of relation(s) that correspond to the owner(s) and the
partial key of the weak entity type W, if any.
3) Mapping of relationship types: form a relation R, for relationship with primary keys
of participating relations A and B as foreign keys in R. In addition to this, any attributes
of relationship become an attribute of R also.
4) Mapping of multivalued attributes: For each multilvalued attribute A, create a new
relation R. This relation R will include an attribute corresponding to A, plus primary key
attribute K-as a foreign key in R-of the relation that represents the entity type or
relationship type that has A as an attribute.
Q.26
and
(7)
Ans:
Relational Data Model The relational model was first introduced by Prof. E.F. Codd of
the IBM Research in 1970 and attracted immediate attention due to its simplicity and
29
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.27
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.28
(7)
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 features 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.
Q.29
What is the purpose of tables, private synonyms and public synonyms? If there are
multiple objects of same name on an Oracle database, which order are they accessed in?
Ans: The purpose of table is to store data. If we use the PUBLIC keyword (or no
keyword at all), anyone who has access to the database can use our synonym. If the
database is not ANSI-compliant, a user does not need to know the name of the owner of a
public synonym. Any synonym in a database that is not ANSI-compliant and was created
in an Informix database server is a public synonym. In an ANSI-compliant database, all
synonyms are private. If you use the PUBLIC or PRIVATE keywords, the database server
issues a syntax error. If you use the PRIVATE keyword to declare a synonym in a
database that is not ANSI-compliant, the unqualified synonym can be used by its owner.
Other users must qualify the synonym with the name of the owner.
Q.30
(14)
Ans:
31
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.31
(7)
Ans: Types of Failures In Oracle database following types of failures can occurred:
Statement Failure
Bad data type
Insufficient space
Insufficient Privileges (e.g., object privileges to a role)
User Process Failure
User performed an abnormal disconnect
User's session was abnormally terminated
User's program raised an address exception
User Error
User drops a table
User damages data by modification
Instance Failure
Media Failure
User drops a table
User damages data by modification
Alert Logs
Records informational and error messages
All Instance startups and shutdowns are recorded in the log
32
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.32
What is ODBC? What are the uses of ODBC? Under what circumstances we use this
technology?
(7)
Ans:
ODBC Open DataBase Connectivity (ODBC) enable the integration of SQL with a
general-purpose programming language. ODBC expose database capabilities in a
standardized way to the application programmer through an application programming
interface (API). In contrast to Embedded SQL, ODBC allows a single executable to
access different DBMSs without recompilation. Thus, while Embedded SQL is DBMSindependent only at the source code level, applications using ODBC are DBMSindependent at the source code level and at the level of the executable.
All direct interaction with a specific DBMS happens through a DBMS-specific driver. A
driver is a software program that translates the ODBC calls into DBMS-specific calls.
Drivers are loaded dynamically on demand since the DBMSs the application is going to
access are known only at run-time. Available drivers are registered with a driver manager.
The driver translates the SQL commands from the application into equivalent commands
that the DBMS understands. An application that interacts with a data source through
ODBC selects a data source, dynamically loads the corresponding driver, and establishes
a connection with the data source. ODBC achieves portability at the level of the
executable by introducing an extra level of indirection. In addition, using ODBC, an
application can access not just one DBMS but several different ones simultaneously.
Q.33
List any two significant differences between a file processing system and a DBMS. (4)
Ans:
File Processing System vs. DBMS
Data Independence - Data independence is the capacity to change the schema at one
level of a database system without having to change the schema at the next level. In file
processing systems the data and applications are generally interdependent, but DBMS
provides the feature of data independence.
Data Redundancy Data redundancy means unnecessary duplication of data. In file
processing systems there is redundancy of data, but in DBMS we can reduce data
redundancy by means of normalization process without affecting the original data. If we
do so in file processing system, it becomes too complex.
Q.34
(5)
Ans: Data Abstraction Abstraction is the process to hide the irrelevant things from the
users and represent the relevant things to the user. Database systems are often used by
non-computer professionals so that the complexity must be hidden from database system
users. This is done by defining levels of abstract as which the database may be viewed,
there are logical view or external view, conceptual view and internal view or physical
view.
33
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.35
What are the various symbols used to draw an E-R diagram? Explain with the help of an
example how weak entity sets are represented in an E-R diagram.
(6)
Ans: Various symbols used to draw an E-R diagram
Symbol
Meaning
ENTITY TYPE
WEAK ENTITY TYPE
RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED
ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
E1
E2
Weak Entity Sets - An entity set that does not have a key attribute is called weak entity
set. A weak entity must participate in an identifying relationship type with an owner or
identifying entity type Entities are identified by the combination of:
A partial key of the weak entity type
The primary key of the identifying entity type
Example:
Suppose that a DEPENDENT entity is identified by the dependents first name and
birhtdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is
a weak entity type with EMPLOYEE as its identifying entity type via the identifying
relationship type DEPENDENT_OF
34
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
BDATE
ADDRESS
EMPLOYEE
DEPENDENTS_OF
DEPENDENT
Name
Q.36
Birth Date
Relationship
(8)
Relationship instance
Ans: Primary Key Primary key is one of the candidate keys. It should be chosen
such that its attribute values are never, or very rarely, changed.
b) Data Manipulation Language (DML) A data manipulation language is a
language that enables users to access or manipulate data as organized by the
appropriate data model.
c) Multivalued Attribute Multivalued attribute may have more than one value for
an entity. For example, PreviousDegrees of a STUDENT.
d) Relationship Instance A relationship is an association among two or more
entities. An instance of relationship set is a set of relationships.
Q.37
Define a table in SQL called Client, which is used to store information about the
clients. Define CLIENT_NO as the primary key whose first letter must start with C.
Also ensure that the column NAME should not allow NULL values.
Column name
Data type
Size
CLIENT_NO
Varchar2
6
NAME
Varchar2
20
ADDRESS1
Varchar2
30
ADDRESS2
Varchar2
30
CITY
Varchar2
15
STATE
Varchar2
15
PINCODE
Number
6
BAL_DUE
Number
10, 2
(7)
35
www.jntuworld.com
www.jntuworld.com
DC10
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
Ans:
CREATE TABLE CLIENT
( CLIENT_NO
VARCHAR2(6) PRIMARY KEY CHECK (CLIENT_NO LIKE
C%),
NAME
VARCHAR2(20) NOT NULL,
ADDRESS1
VARCHAR2(30),
ADDRESS2
VARCHAR2(30),
CITY
VARCHAR2(15),
STATE
VARCHAR2(15),
PINCODE NUMBER(6),
BAL_DUE NUMBER(10,2))
Q.38
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.41
Explain the concept of a data model. What data models are used in
database management systems?
(7)
Ans:
Data Model Model is an abstraction process that hides irrelevant details while
highlighting details relevant to the applications at hand. Similarly, a data model is a
collection of concepts that can be used to describe structure of a database and provides the
necessary means to achieve this abstraction. Structure of database means the data types,
relationships, and constraints that should hold for the data. In general a data model
consists of two elements:
A mathematical notation for expressing data and relationships.
Operations on the data that serve to express queries and other manipulations of the
data.
37
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Network Model - It was formalised in the late 1960s by the Database Task Group of
the Conference on Data System Language (DBTG/CODASYL). It uses two different
data structures to represent the database entities and relationships between the entities,
namely record type and set type. In the network model, the relationships as well as the
navigation through the database are predefined at database creation time.
Relational Model - The relational model was first introduced by E.F. Codd of the
IBM Research in 1970. The model uses the concept of a mathematical relation (like a
table of values) as its basic building block, and has its theoretical basis in set theory
and first-order predicate logic. The relational model represents the database as a
collection of relations.
Object Oriented Model This model is based on the object-oriented programming
language paradigm. It includes the features of OOP like inheritance, object-identity,
encapsulation, etc. It also supports a rich type system, including structured and
collection types.
Object Relational Model This model combines the features of both relational
model and object oriented model. It extends the traditional relational model with a
variety of features such as structured and collection types.
Q.43
(7)
Ans: Stand alone Query Language The query language which can be used
interactively is called stand alone query language. It does not need the support of a host
language.
Embedded Query Language A query language (e.g., SQL) can be implemented in two
ways. It can be used interactively or embedded in a host language. The use of query
language commands within a host language (e.g., C, Java, etc.) program is called
embedded query language. Although similar capabilities are supported for a variety of
host languages, the syntax sometimes varies.
Data Manipulation Language (DML) A data manipulation language is a language
that enables users to access or manipulate data as organized by the appropriate data
model.
Q.44
Consider the following relations for a database that keeps track of business trips of
salespersons in a sales office:
SALESPERSON (SSN, Name, start_year, Dept_no)
TRIP (SSN, From_city, To_city, Departure_Date, Return_Date, Trip_ID)
EXPENSE(TripID, Account#, Amount)
Specify the following queries in relational algebra:
(4x3 =12)
(i) Give the details (all attributes of TRIP) for trips that exceeded $2000 in expenses.
(ii) Print the SSN of salesman who took trips to Honolulu
38
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.45
(2)
(2)
Ans: A cursor is an object used to store the output of a query for row-by-row
processing by the application programs. SQL statements operate on a set of data and
return a set of data. On other hand, host language programs operate on a row at a time.
The cursors are used to navigate through a set of rows returned by an embedded SQL
SELECT statement. A cursor can be compared to a pointer.
Q.47
Write a program in embedded SQL to retrieve the total trip expenses of the salesman
named John for the relations of Q. 44
(6)
Ans:
EXEC SQL BEGIN DECLARE SECTION;
long total_expenses;
EXEC SQL END DECLARE SECTION;
EXEC SQL
SELECT SUM(AMOUNT) INTO :total_expenses FROM EXPENSE WHERE TRIPID
IN (SELECT TRIP_ID FROM TRIP
WHERE SSN = (SELECT SSN FROM SALEPERSON WHERE NAME = John));
printf(\nThe total trip expenses of the salesman John is: %ld, total_expenses);
Q.48
What are views? Explain how views are different from tables.
(6)
Ans:
A view in SQL terminology is a single table that is derived from other tables. These other
tables could be base tables or previously defined views. A view does not necessarily exist
in physical form; it is considered a virtual table, in contrast to base tables, whose tuples
are actually stored in the database. This limits the possible update operations that can be
applied to views, but it does not provide any limitations on querying a view. A view
represents a different perspective of a base relation(s). The definition of a view in a create
view statement is stored in the system catalog. Any attribute in the view can be updated as
long as the attribute is simple and not derived from a computation involving two or more
39
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.49
What do you mean by integrity constraints? Explain the two constraints, check and
foreign key in SQL with an example for each. Give the syntax.
(8)
(6)
What are the different types of database end users? Discuss the main activities of each.
(7)
Ans:
End-Users End-users are the people whose jobs require access to the database for
querying, updating, and generating reports; the database primarily exists for their use. The
different types of end-users are:
Casual end-users occasionally access the database, need different information each
time
Naive or Parametric end-users includes tellers, clerks, etc., make up a sizable
portion of database end-users, main job function revolves around constantly querying
and updating the database
40
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.52
Sophisticated end-users includes engineers, scientists, business analyst, etc., use for
their complex requirements
Stand-alone users maintain personal databases by using ready-made program
packages, provide easy-to-use menu-based or graphics-based interfaces
Discuss the typical user friendly interfaces and the types of users who use each.
(7)
Ans:
User-friendly interfaces provided by a DBMS may include the following:
Menu-Based Interfaces for Web Clients or Browsing These interfaces present the
user with lists of options, called menus, that lead the user through the formulation of a
request. Pull-down menus are a very popular techniques in Web-based user interfaces.
They are also used in browsing interfaces, which allow a user to look through the
contents of a database in an exploratory and unstructured manner.
Forms-Based Interfaces A forms-based interface displays a form to each user.
Forms are usually designed and programmed for naive users and interfaces to canned
transactions. Many DBMSs have forms specification languages.
Graphical User Interfaces (GUIs) A GUI typically displays a schema to the user in
diagrammatic form. The user can then specify a query by manipulating the diagram. In
many cases, GUIs utilizes both menus and forms. Most GUIs use a pointing device to
pick certain parts of the displayed schema diagram.
Natural Language Interfaces These interfaces accept requests written in English or
some other language and attempt to understand them. A natural language interface
usually has its own schema, which is similar to the database conceptual schema, as
well as a dictionary of important words.
Interfaces for Parametric Users Parametric users, such as bank tellers, often have a
small set of operations that they must perform repeatedly. The interfaces for these users
usually have a small set of abbreviated commands with the goal of minimizing the
number of keystrokes required for each request.
Interfaces for the DBA Most database systems contain privileged commands that can
be used only by the DBAs staff. These include commands for creating accounts, setting
system parameters, granting account authorization, changing a schema, and a
reorganizing the storage structures of a database.
Q.53
With the help of an example show how records can be deleted and updated in QBE. (5)
(i) Increase Pay_Rate of employees with the skill of cook by 10%.
(ii) Delete employee record for EMP# 123459
Ans: (i)
EMPLOYEE
Name
Skill
Cook
U.
Emp#
EX
EX
Pay_Rate
PX
PX * 1.1
EMPLOYEE
D.
Emp#
123459
Name
Skill
Pay_Rate
(ii)
Q.54
www.jntuworld.com
(4)
www.jntuworld.com
www.jwjobs.net
DC10
Q.55
Information about a bank is about customers and their account. Customer has a name,
address which consists of house number, area and city, and one or more phone numbers.
Account has number, type and balance. We need to record customers who own an
account. Account can be held individually or jointly. An account cannot exist without a
customer.
Arrive at an E-R diagram. Clearly indicate attributes, keys, the cardinality ratios and
participation constraints.
(10)
Ans:
P ho ne_ no
ar ea
cit y
Ho us e_ no
na me
CU ST OM E R
ad d r e ss
( I.M)
name
t yp e
O wn s a cco u nt
Acco u n t _ no
Q.56
t yp e
d eta il s
ACCOUNT TYPE
b ala nc e
Describe the static hash file with buckets and chaining and show how insertion, deletion
and modification of a record can be performed.
(9)
Ans:
In static hash file organization, the term bucket is used to denote a unit storage that can
store one or more records.A file consists of buckets 0 through N-1, with one primary page
per bucket initially and additional overflow pages chained with bucket, if required later.
Buckets contain data entries (or data records). In hashing scheme, a hash function, h, is
performed on the key of the record to identify the bucket to which data record belongs to.
The hash function is an important component of the hashing approach. The main problem
with static hash file is that the number of buckets is fixed.
42
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
0
1
N-1
Primary Bucket Pages
Overflow Pages
correct bucket and then put the data entry there. If there is no space for this data entry, a
new overflow page will be allocated, put the data entry on this page, and the page to the
overflow chain of the bucket.
Deletion of a record To delete a data entry, the hash function is used to identify the
correct bucket, locate the data entry by searching the bucket, and then remove it. If the
data entry is the last in an overflow page, the overflow page is removed from the overflow
chain of the bucket and added to a list of free pages.
Modification of a record To modify a data entry, the hash function is used to identify
the correct bucket, locate the data entry by searching the bucket and get it, modify the
data entry, and then rewrite the modified data entry on it.
Q.57
Ans:
Variable-Length Records Variable-length records are those records, which are of
different sizes. A file may contain variable-length records in any of the following
situations:
Records having variable length fields In this case, the end-of-field symbol along
with end-of-record symbol can be used as the separator characters.
Records having repeating fields In this case, the number of repetitions of repeating
fields can be used with end-of-record symbol as the separator characters.
Records having optional fields In this case, the end-of-field symbol along with endof-record symbol can be used as the separator characters.
File containing records of different record types - In this case, a special field (or
control field) can be prefixed with each record and end-of-record symbol can be used as
the separator characters.
In each of the above situations either we can use end-of-record symbol or the length of
each record can be prefixed at the beginning of the record for the separation of the
variable-length records.
Q.58
(i)
(7 x 2 = 14)
43
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Distributed system.
Interblock gap
Degree of a relation.
Catalog
Conceptual schema
DDL and SDL.
Ans: (i) Derived and Stored Attribute - In some cases, two or more attribute values are
related, for example, Age and BirthDate attributes of a person. For particular person
entity, the value of Age can be determined from the current date and the value of that
persons BirthDate. Hence, the attribute Age is called as derived attribute and the
attribute BirthDate is called as stored attribute.
(ii) Distributed System A distributed system consists of a number of processing
elements that are interconnected by a computer network and that cooperate in performing
certain assigned tasks.
(iii) Interblock Gap A track of a disk is divided into equal-sized disk blocks. Blocks
are separated by fixed-size gaps, called as interblock gaps, which include specially coded
control information written during disk initialization.
(iv) Degree of a Relation The degree or arity of a relation is the number of attributes
n of its relation schema.
(v) Catalog A relational DBMS maintains information about every table and index
that it contains. A catalog is a collection of special tables, which stores the descriptive
information of every table and index.
(vi) Conceptual Schema Conceptual schema describes the structure of the whole
database for a community of users. It hides the details of physical storage structures and
concentrates on describing entities, data types, relationships, and constraints.
(vii) DDL and SDL The data definition language (DDL) is used by DBA and
database designers to define conceptual schema, internal schema, and mappings
between these two. In some DBMSs, a clear separation is maintained between
conceptual schema and internal schema. In that case, DDL is used to specify the
conceptual schema only. Another language, storage definition language (SDL) is used
to specify the internal schema. The mappings between the two schemas may be
specified in either one of these languages.
Q.59
Define a relation.
(2)
(6)
Ans:
Entity Integrity Rule If the attribute A of relation R is a prime attribute of R then A
cannot accept null values.
44
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.61
Enrl No
11
15
6
33
GRADE
Roll No
17
16
6
75
Roll No
6
17
75
6
16
Course
C
VB
VB
DBMS
C
Name
Ankit Vats
Vivek Rajput
Vanita
Bhavya
City
Delhi
Meerut
Punjab
Delhi
Mobile
9891663808
9891468487
9810618396
Grade
A
C
A
B
B
Roll No is the primary key in the relation STUDENT and Roll No + Course is the
primary key of the relation GRADE. (Entity Integrity)
Roll No in the relation GRADE (child table) is a foreign key, which is referenced from
the relation STUDENT (parent table). (Referential Integrity).
Consider the two relations given below
R
S
A
B
C
A1
b1
c1
D
A
F
Null
b2
null
d1
a1
f1
a1
b1
c1
d1
a2
null
Given that A is the primary key of R, D is the primary key of S and there is a referential
integrity between S.A and R.A, discuss all integrity constraints that are violated.
(6)
Ans: (i) Primary key of R contains the null value and the value a1 is duplicated, hence
it violates the entity integrity constraint in the relation R.
(ii) In primary key of S, the value d1 is duplicated, hence it violates the entity integrity
constraint in the relation S.
(iii) The foreign key S.A contains the value a2, which is not available in the parent key
R.A, hence it violates the referential integrity constraint in the relation S.
Q.62
www.jntuworld.com
(3.5 x 4 = 14)
www.jntuworld.com
www.jwjobs.net
DC10
(i)
Ans
SELECT P.NAME FROM TRAIN T, TICKET I, PASSENGER P
WHERE P.PNRNO = I.PNRNO AND T.NAME = I.NAME
AND T.START = I.START AND T.DEST = I.DEST
(ii) SELECT NAME FROM PASSENGER
WHERE PNRNO IN (SELECT DISTINCT A.PNRNO
FROM TICKET A, TICKET B WHERE A.PNRNO = B.PNRNO
AND A.START = B.DEST AND A.DEST = B.START)
(iii) INSERT INTO TRAIN
VALUES(Shatabdi, Delhi, Banglore
(iv) DELETE FROM TICKET
WHERE PNRNO = (SELECT PNRNO FROM PASSENGER
WHERE NAME = Tintin)
(i)
Q.63
Define outer union operation of the relational algebra. Compute the outer union for the
relations R and S given below.
(2 x 3)
R
S
A
B
C
D
A
F
a1
b1
c1
d1
a1
f1
a3
b2
c2
d1
a2
null
Ans:
Outer Join - If there are any values in one table that do not have corresponding value(s)
in the other, in an equi-join that will not be selected. Such rows can be forcefully selected
by using the outer join. The corresponding columns for that row will have NULLs. There
are actually three forms of the outer-join operation: left outer join ( X), right outer join
(X ) and full outer join ( X ).
R.A
a1
a3
Null
Q.64
B
b1
b2
Null
C
c1
c2
Null
D
d1
Null
d1
S.A
a1
Null
a2
F
f1
Null
Null
www.jntuworld.com
(3 x 3)
www.jntuworld.com
www.jwjobs.net
DC10
Q.65
Describe DROP TABLE command of SQL with both the options CASCADE
and RESTRICT.
(5)
Ans:
DROP TABLE command This command drops the specified table. Dropping a table
also drops indexes and grants associated with it. Objects built on dropped tables are
marked invalid and cease to work.
CASCADE and RESTRICT options The DROP TABLE with RESTRICT option
destroy the table unless some view or integrity constraint refer to the given table; if so, the
command fails. But with the CASCADE option, any referencing views or integrity
constraints are (recursively) dropped as well.
Q.66
(3 x 3)
Ans:Data Block In oracle the data blocks are referred to as tablespaces. A tablespace is
an area of disk consisting of one or more disk files. A tablespace can contain many tables,
indexes, or clusters.
(ii) Data Dictionary Data dictionaries are the system tables that contain descriptions
of the database objects and how they are structured.
(iii) Segments Each table has single area of disk space, called segment, set aside for it
in the tablespace. Segments consists of contiguous sections called extents.
Q.67
Describe the responsibilities of the DBA and the database designer. (7)
Ans: The responsibilities of DBA and database designer are:
1. Planning for the database's future storage requirements
2. Defining database availability and fault management architecture
3. Defining and creating environments for development and new release
installation
4. Creating physical database storage structures after developers have designed an
application
5. Constructing the database
6. Determining and setting the size and physical locations of data files
7. Evaluating new hardware and software purchase
8. Researching, testing, and recommending tools for Oracle development,
modeling, database administration, and backup and recovery implementation, as
well as planning for the future
9. Providing database design and implementation
47
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.68
What
Ans:
Q.69
are
the
four
main
characteristics
of
the
database
approach?
(7)
(4)
Ans:
DDL - Data Definition Language: statements used to define the database
structure or schema. Some examples:
CREATE - to create objects in the database
ALTER - alters the structure of the database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated for
the records are removed
COMMENT - add comments to the data dictionary
RENAME - rename an object
DML - Data Manipulation Language: statements used for managing data within
schema objects. Some examples:
SELECT - retrieve data from the a database
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - deletes all records from a table, the space for the records remain
MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - explain access path to data
Q.70
(3)
Ans:
The disadvantages of database system are:
Database systems are complex, difficult, and time-consuming to design.
Substantial hardware and software start-up costs.
Damage to database affects virtually all applications programs.
Extensive conversion costs in moving form a file-based system to a database system.
Initial training required for all programmers and users.
Q.71
Explain the utilities that help the DBA to manage the database.
(7)
Ans:
Every DBA uses database utilities to manage and control their databases. But
there is a lot of confusion in the field as to what, exactly, is a database utility. There are a
48
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.72
Differentiate between
(i) WHERE and HAVING clause in SQL.
(ii) Strong entity set and weak entity set.
(iii) Spanned and unspanned organisation.
(3.5
3)
Discuss with examples about various types of attributes present in the ER model.
(6)
Ans:
Types of Attributes are:
SIMPLE attributes are attributes that are drawn from the atomic value domains
E.g. Name = {John} ; Age = {23}
49
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.74
Information about films contains information about movies, stars and studios. Movies
have a title, year of production, length and the film type. Stars have a name and address.
Studios have a owner and a banner. Movies are shot in studios which own them. A
movie is shot in only one studio. Stars are connected to one or more studios but can act in
any film which may or may not be owned by the studio. Arrive at an E-R diagram.
Clearly indicate attributes, keys, the cardinality ratios and participation constraints. (8)
Ans:
Le ng t h
Yo p
Na me
F il m t y pe
Ad dr es s
Tit le
M o v ies
Stars
Act
Sho t
Co n ne ct
St u d io
O w ner
Q.75
B a nn er
What is the main goal of RAID technology? Describe the levels 1 through 5.
(6)
Ans:
RAID stands for Redundant Array of Inexpensive (or sometimes
"Independent")Disks.
RAID is a method of combining several hard disk drives into one logical unit (two or
50
www.jntuworld.com
www.jntuworld.com
DC10
Q.76
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
more disks grouped together to appear as a single device to the host system). RAID
technology was developed to address the fault-tolerance and performance limitations of
conventional disk storage. It can offer fault tolerance and higher throughput levels than a
single hard drive or group of independent hard drives. While arrays were once
considered complex and relatively specialized storage solutions, today they are easy to
use and essential for a broad spectrum of client/server applications.
RAID 1 : Mirrored set without parity. Provides fault tolerance from disk errors and
failure of all but one of the drives. Increased read performance occurs when using a
multi-threaded operating system that supports split seeks, very small performance
reduction when writing. Array continues to operate so long as at least one drive is
functioning. Using RAID 1 with a separate controller for each disk is sometimes called
duplexing. SNIA definition.
RAID 2: Redundancy through Hamming code. Disks are synchronised and striped in
very small stripes, often in single bytes/words. Hamming codes error correction is
calculated across corresponding bits on disks, and is stored on multiple parity disks.
SNIA definition.
RAID 3: Striped set with dedicated parity/Bit interleaved parity. This mechanism
provides an improved performance and fault tolerance similar to RAID 5, but with a
dedicated parity disk rather than rotated parity stripes. The single parity disk is a bottleneck for writing since every write requires updating the parity data. One minor benefit is
the dedicated parity disk allows the parity drive to fail and operation will continue
without parity or performance penalty.
RAID 4: Block level parity. Identical to RAID 3, but does block-level striping instead of
byte-level striping. In this setup, files can be distributed between multiple disks. Each
disk operates independently which allows I/O requests to be performed in parallel,
though data transfer speeds can suffer due to the type of parity. The error detection is
achieved through dedicated parity and is stored in a separate, single disk unit.
RAID 5: It distributes data and parity information across all disks.
An employee record has the following structure
struct employee {
int
eno;
char name[22];
float salary;
char dept[10];};
(i) Calculate the record size R in bytes.
(ii) If the file has 500 records, calculate the blocking factor bfr and the number of
blocks b, assuming an unspanned organization with block size B = 512 bytes.
(iii) What is the unused space in each block and in the last block?
(8)
Ans: (i) 2 + 22+ 4 + 10 =38 bytes
(ii) bfr = floor( B/R) = [512/38] =13
Number of blocks b = ceiling (500/13) =39
(iii) Unused space in each block
= 512 38 *13 = 512 494= 18 bytes
Unused space in the last block
= ( 39 *13 500) * 38 bytes = (507 -500) * 38 bytes
= 7 * 38 =266 bytes
51
www.jntuworld.com
www.jntuworld.com
DC10
Q.77
Q.78
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
Define the following terms
(i) Hashing
(ii) Specialization
(iii) Value set.
(iv) DBMS.
(v) Host language. (vi) Database state.
(vii) Trigger.
(2 x 7)
Ans:
(i)
Hashing: Hashing is a method to store data in an array so that storing,
searching, inserting and deleting data is fast (in theory it's O(1)). For this every record
needs an unique key.
The basic idea is not to search for the correct position of a record with comparisons but to
compute the position within the array. The function that returns the position is called the
'hash function' and the array is called a 'hash table'.
(ii) Specialization: Specialization allows you to define new kinds of information (new
structural types or new domains of information), while reusing as much of existing design
and code as possible, and minimizing or eliminating the costs of interchange, migration,
and maintenance.
(iii) Value set: It is a set of values. You do not always want a user to enter junk free text
into all the fields. Hence, Oracle Apps uses value set to validate that correct data is being
entered in the fields in screen.
(iv) DBMS: database management system (DBMS) is computer software designed for the
purpose of managing databases based on a variety of data models.
(v) Host Language: You can write applications with SQL statements embedded within
a host language. The SQL statements provide the database interface, while the host
language provides the remaining support needed for the application to execute.
(vi) Database state: The actual data in the database at a particular moment in time is
called a database state.
(vii) Trigger: A database trigger is procedural code that is automatically executed in
response to certain events on a particular table in a database. Triggers can restrict access
to specific data, perform logging, or audit data modifications.
Differentiate between natural join and outer join.
(2)
Ans: Natural join is a binary operator that is written as (R * S) where R and S are
relations. The result of the natural join is the set of all combinations of tuples in R and S
that are equal on their common attribute names. In this only one column out of columns
having same name attributes is retained.
An Outer join contains those tuples and additionally some tuples formed by extending
an unmatched tuple in one of the operands by "fill" values for each of the attributes of the
other operand.
Q.79
B
2
2
6
52
www.jntuworld.com
S
C
3
3
7
D
10
11
12
(12)
www.jntuworld.com
www.jwjobs.net
DC10
C
3
6
9
C
3
3
D
10
11
(iv)
B
C
1
2
3
1
2
3
Assuming left outer join
A
1
1
4
7
Q.80
B
2
2
5
8
C
3
3
6
9
D
10
11
D
10
11
NULL
NULL
Define union compatibility? Explain why INTERSECTION of two relations can not be
performed if they are not union compatible? (4)
Ans: Two relations R(A1, A2,-------, An) and S(B1, B2,-----, Bn) are said t union
compatible if they have the same degree n and if dom (Ai) = dom(Bi) for all i=1---n
Intersection requires two relations to be union compatible since otherwise it is not
possible to formulate the criterion as to on what basis will attributes be considered as
common.
Q.81
(4)
Ans: A view is a virtual table that consists of columns from one or more tables. Though
it is similar to a table, it is stored in the database. It is a query stored as an object. Hence,
a view is an object that derives its data from one or more tables. These tables are referred
to as base or underlying tables.
Views can be updated if they are defined on a single table without any aggregate
functions can be mapped to an update on the underlying base table under certain
conditions.
Q.82
Using SQL create a view RS for the relations R and S of Q79. The view consists of the
columns A and D renamed as X and Y respectively. Insert a tuple <10, 15> into it.
Show the contents of the view.
(6)
Ans:
Q.83
53
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Ans: (i) Select name, regno from PHYSICIAN where city = Delhi;
(ii)
Select pname, city from PATIENT,VISIT where PATIENT.pname=VISIT.pname
and date_of_visit = 31-Aug-04;
(iii) select name, count(*) from PHYSICIAN, VISIT
where PHYSICIAN.regno = VISIT.regno group by
Physician . regno;
(iv)
This will give the name of physicians who have not visited any patient.
Q.84
(3.5 x 4)
Data models: A data model is an abstract model that describes how data is
Ans: (i)
represented and accessed.
The term data model has two generally accepted meanings:
A data model theory, i.e. a formal description of how data may be structured and
accessed.
A data model instance, i.e. applying a data model theory to create a practical data model
instance for some particular application.
(ii)
Oracle database structure:
The relational model has three major aspects:
Structures: Structures are well-defined objects that store the data of a database.
Structures and the data contained within them can be manipulated by operations.
Operations:
Operations are clearly defined actions that allow users to manipulate the
data and structures of a database. The operations on a database must adhere to a predefined set of integrity rules.
Integrity Rule: Integrity rules are the laws that govern which operations are allowed on
the data and structures of a database. Integrity rules protect the data and the structures of a
database.
54
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.85
(6)
Ans: Applications are designed in isolation. Design of application is optimized for one
application. Independently developed applications leads to data redundancy. Wasted
storage space due to redundancy.
a.
There is loss of data integrity because integrity checking is not automated.
b.
Difficulty in accessing data.
Information is available only in reports.
c.
d.
Data Isolation.
e.
Inadequate security
f.
Limited Flexibility
g.
High Maintenance cost.
Each data file of an application is a separate entity.
h.
Q.86
Explain the three data models namely relational, network and hierarchical and compare
their relative advantages and disadvantages.
(10)
Ans:
Hierarchical Model: In hierarchical model, data elements are connected to one
another through links. Records are arranged in a top-down structure that resembles a tree
or genealogy chart. The top node is called the root, the bottom nodes are called leaves,
and intermediate nodes have one parent node and several child nodes. The root can have
any number of child nodes but a child node can have only one parent node. Data are
related in a nested, one-to-many set of relationships, while many-to-many relationship
cannot be directly expressed.
A child record occurrence must have a parent record occurrence; deleting a parent
record occurrence requires deleting all its child record occurrences.
A network data model can be regarded as an extended form of the hierarchical model;
the principle distinction between the two being that in a hierarchical model, a child record
55
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.87
In an organization several projects are undertaken. Each projects can employ one or more
employees. Each employee can work on one or more projects. Each project is
undertaken on the required of client. A client can request for several projects. Each
56
www.jntuworld.com
www.jntuworld.com
DC10
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
project have only one client. A project can use a number of items and a item may be used
by several projects. Draw an E-R diagram and convert it to a relational schema.
(10)
Ans: The ER Diagram can be converted into the following relational schema.
Entity Sets
(i)
Employee (Empno, Name, Salary, Desig)
(ii)
Project (P_id, Pname, P-desc)
(iii)
Item (I_id, Iname, I-desc)
(iv)
Clients (C_id,Cname, Address)
(v)
Works_on (Empno, P_id)
(vi)
Requests (P_id, C_id)
(vii) Requires (P_id, I_id)
E mp
P _ id
Na me
P _ d ese
o
E mp lo ye e
P na me
P r o j ect
Works
_on
Sal ar y
Req u ir e s
De si g
Req u es t s
Cl ie n ts
C_ id
Q.88
I te m
Ad d r e ss
C na me
I _ id
I na me
I _ d es e
(6)
Ans: (i) Identifying relationship : It is relationship between strong entity and a weak
entity it is represented by a doubly outlined diamond in Chen notation.
(ii)
Specialisation /generalization : This is a top down / bottom up approach to the
design of database. It shows the IS_A relationship between a super class (parent)
and associated sub-classes. It is represented by inverted triangle in the Chen
notation.
(iii) Aggregation : This is used whenever we intend to show a relationship between an
entity and the relationship. There is no provision for this in the ER Model. This is
shown by placing the relationship between two entities alongwith the entities in a
box and setting up a relationship between this box and another entity.
57
www.jntuworld.com
www.jntuworld.com
DC10
Q.89
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
A well-maintained relational DBMS has a high level of data integrity. What features of a
relational DBMS contribute towards this level of integrity? (6)
Ans:
Relational DBMS provides high level of data integrity, by using the following
rules:
Entity Integrity: Entity integrity says that a prime attribute in a relation can not accept
null values.
Referential Integrity: The referential integrity rule is related with the foreign key
concept. Let R1 and R2 are two relations where R1 is having an attribute(s) with primary
key. Let R2 be having a foreign key, which refers to relation R1 via the same set of
attributes. Then the value of the foreign key in a tuple in R2 relation must either be equal
to primary key of a tuple in a relation R1 relation or be entirely NULL.
In a more general way, the referential integrity rule states that every foreign key
value must match a primary key value in an associated table. Referential integrity ensures
that we can correctly navigate between related entities> Referential Integrity is a state
where each foreign key value has matching primary key value. In other words, it
guarantees that data in a dependent table has matching records in the table(s) on which it
depends. With modern databases, referential integrity is enforced with the use of primary
and foreign keys, which will not allow insertions, deletions, or changes to data that
violate the rules of integrity configured by the database administrator.
Student_id
Subject_code
Semester_code
Subject_name
Lecturer_id
Lecturer-name
Grade
X (6)
X(6)
X(6)
X(20)
X(8)
X(20)
X(6)
58
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.90
(10)
Ans:
Data dictionary is a database in its own right residing on the disk which consist
of Meta data which is = Data about all entity sets + attributes + relationships among entity
sets + constraints. It consist of compiled form of definitions, structure and usage
information on data stored, design decisions, usage standards, application programme
descriptions, user information. It is consulted by DBMS before DML operation and by
user to learn what each piece of data and various synonymous of data fields mean. Data
dictionary can be integrated system where it is part of DBMS or add ons to DBMS. In
integrated system data dictionary contains information concerning external, conceptual
and internal level of data base. Both in source and object form. It contains source code
of each data field value, frequency of its use, audit trail concerning updates and cross
reference information. Present system are all add ons standards do not exist for iintegrity
data dictionary with DBMS. Data dictionary should be integrated in database it defines
and thus include its own definition so that it can be queried with the same language use
for queering database.
Q.91
Differentiate between
(i) Procedural and non procedural languages.
(ii) Key and superkey
(iii) Primary and secondary storage
(3 x 3)
Ans: (i) Procedural and non procedural languages - A procedural language specifies
the operations to be performed on the existing data to derive the results. It also specifies
the sequence of operations in which they will be performed. But, a non procedural
language specifies only the result or information required not how it is obtained.
(ii)
Key and superkey - A key a single attribute or a combination of two or more
attributes of an entity set that is used to identify one or more instances (rows) of the set
(table). If we add some additional attributes to a primary key then that augmented key is
called as super key. Therefore, the primary key is the minimum super key.
(iii)
Primary and secondary storage Primary storage device stores the data
temporarily. Primary storage is generally used by the processing unit to temporary store
the data, intermediate results, and the final results before storing to the secondary storage
because the secondary storage devices are not directly accessible by the CPU. But, if we
want to store data permanently then the secondary storage devices are required.
Secondary storage devices are slower than the primary storage devices.
Q.92
Ans:
(i)
Select Fname, Lname from STAFF, BRANCH where STAFF.bno =
BRANCH.bno and street = 163 main street
59
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.93
(i)
(ii)
(iii)
(iv)
(v)
(vi)
(vii)
Consider
employee
(e_no,
e_name,
e_salary,
d_code),
dept
(d_code, d_name) and dependent (depndt_name, e_no, relation).
Show the names of employees in purchase and accounts departments with at least
one dependent.
Consider student (std_id, std_name, date_of_birth, phone, dept_name). Put the data
for a student with student id200, name arun, birth date 1st February, 1985, phone
number (01110 32818 and dept name English in the student table.
A constraint named less_than_20 was defined on the field date_of_birth of table
student. Delete this constraint.
Consider the table student and list names of students in the departments other than
maths and computer.
Consider employee table of (i) and list names of department(s) for which average
salary for department is more than 10,000.
Create role named role_table that allows a user to create tables. Using role_table
allow users kripa and reena to create tables.
Create a view emp_dep containing e_name and number of dependents from the
tables employee and dependent of (i)
(2x7)
Mention the kind of constraints we can specify in the CREATE command of DDL.
(2)
Ans:
The kind of constraints which can be specified are as follows:PRIMARY KEY, NOT NULL, UNIQUE, FOREIGN KEY, CHECK.
60
www.jntuworld.com
www.jntuworld.com
DC10
Q.95
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
What is the difference between a primary index and a secondary index? What are the
advantages of using an index and what are its disadvantages.
(10)
Ans: Primary Index: A primary index is an ordered file whose records are of fixed
length with two fields. The first field is the ordering key field-called primary key-of the
data file, and the second field is a pointer to a disk block. There is one index entry in the
index file for each block in the data file. Each index entry has the value of the primary
key field for the first record in a block and a pointer to that block as its two field values. A
major problem with a primary index is insertion and deletion of records. If we attempt to
insert a record in its correct positioning the data file, we have to not only move records to
make space for the new record but also change some index entries.
Secondary Index: A secondary index is also an ordered file with two fields. The first
field is non-ordering field of the data file that is an indexing field. The second field is
either a block pointer or a record pointer. A secondary index on a candidate key looks just
like a dense primary index, except that the records pointed to by successive values in the
index are not stored sequentially.
In contrast, if the search key of a secondary index is not a candidate key, it is not enough
to point to just the first record with each search-key value. The remaining records with
the same search key value could be anywhere in the file, since the records are ordered
by the search key of the primary index, rather than by the search key if the secondary
index. Therefore, a secondary index must contain pointers to all the records. Secondary
indices improve the performance of queries that use keys other than the search key of the
primary index. However, they impose a significant overhead on modification of the
database. The designer of a database decides which secondary indices are desirable on an
estimate of the relative frequency of querys and modifications.
Some of the advantages of using an index are:
(i)
Indexes speed up search on the indexed attributes(s). Without an index either a
sequential search or some sort of binary search would be needed.
(ii)
Indexes can also speed up sequential processing of the file when the file is not
stored as a sequential file.
Some of the disadvantages of using an index are :
(i) An index requires additional storage. This additional storage can be significant
when a number of indexes are being used on a file.
(ii)
Insertion, deletion and updates on a file with indexes takes more time than on a
file without any indexes.
Q.96
What are the causes of bucket overflow in a hash file organization? What can be done to
reduce the occurrence of bucket overflow?
(6)
Ans: When a record is inserted, the bucket to which it is mapped has space to store the
record. If the bucket does not have enough space, a bucket overflow is said to occur.
Bucket overflow can occur for several reasons:
Insufficient buckets : The number of buckets, which we denote nb, must be chosen such
than nb>nr/fr, where nr, denotes the total number of records that will be stored, and fr,
denotes the number of records that will fit in a bucket. This designation, of course,
assumes that the total number of records is known when the hash function is chosen.
Skew : Some buckets are assigned more records than are others, so a bucket may
overflow even when other buckets still have space. This situation is called bucket skew.
Skew can occur for two reasons:
61
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.97
(8)
Ans:
Query-by-example represents a visual/graphical approach for accessing
information in a database through the use of query templates called as skeleton tables. It
is used by entering example values directly into a query template to represent what is to
be achieved. QBE was developed at IBMs. T.J. Watson Research Centre and it is used by
many database systems for personal computers. QBE is a very powerful facility that gives
the user the capability to access the information a user wants without the knowledge of
any programming language.
Queries in QBE are expressed by skeleton tables. QBE has two distinct features :
QBE has two-dimensional syntax : Queries look like tables.
QBE queries are expressed by example. Instead of giving a procedure for obtaining
the desired answer, the user gives an example of what is desired.
An example of QBE is given as
EMPNO
NAME
P..x
SALARY
DESIG
Manager
DEPTNO
This query tells the system to look for tuples in EMP relation that have designation
Manager. For each such tuple, the system assigns the value of the Ename attribute to the
variable x and prints it.
Q.98
(8)
Ans:
Primary Key : The primary key is an attribute or a set of attributes that
uniquely identify a specific instance of an entity. Every entity in the data model must have
a primary key whose values uniquely identify instances of the entity.
To qualify as a primary key for an entity, an attribute must have the following properties :
* It must have a non-null value for each instance of the entity.
* The value must be unique for each instance of an entity
* The values must not change or become null during the life of each entity instance.
Candidate Key and Alternate Key : In some instances, an entity will have more than
one attribute that can serve as a primary key. Any key or minimum set of keys that could
be a primary key is called a candidate key. Ones candidate keys are identified, one of
62
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.99
(10)
Ans:
DML compiler, Embedded DML compiler, DDL Interpreter, Query Evaluation
Engine, Authorization and integrity Manager, Transaction Manager, File Manager, Buffer
Manager.
DML Compiler : Translates DML statements in a query language into low level
instructions understandable by the query evaluation engine. Attempts to transforms users
request into an equivalent and more efficient from for executing the query understandable
by Data Manager, Interprets DDL statements and records them in a set of tables
containing Meta data in a form that can be used by other components of a DBMS.
Query Evaluation engine : Vehicle executes low-level instructions generated by the
DML compiler.
The Storage Manager components provide interface between the low level data stored in
the database and application programs and queries submitted to the system. It is central
software component of DBMS and called database control system also.
Authorization and Integrity Manager : Tests for the satisfaction of integrity constraints
and checks the authority of users to access data.
Transaction Manager : Ensure the database remains in a constant (correct) state despite
system failure, and that concurrent transaction executions proceed without conflicting.
File Manager : Manager allocation of space on disk storage and the data structures used
to represent into stored on disk. It is also responsible for
- Locating block of target record
- Requesting block from disk Manager
- Transmitting required record to data Manager
This file Manager can be implemented using an interface to the existing file subsystem
provided by the O.S. of the host computer or it can include a file subsystem written
especially for DBMS.
Disk Manager : Responsible for fetching data regulated by file Manager from disk
storage into Main memory and deciding what data to cache in memory.
It is a part of the O.S. of host computer and all physical input/output operations are
performed by it. It provides disk abstraction to file Manager s.t. file Manager need not be
concerned with the physical characteristics of the underlying storage media.
Functions of Data Manager :
- Convert operations in users queries coming directly via query processor or indirectly
in an application program from users logical view to a physical file system.
- It interfaces with file system enforces constraints to maintain consistency. And
integrity of the data as well as its security. (Authorization and Integrity Manager).
- Synchronizing simultaneous operations performed by concurrent users. (Transaction
Manager)
Back up and recovery operations (Transaction Manager)
63
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.100
Describe the GRANT function and explain, how it relates to security. What types of
privileges may be granted? How are they revoked?
(6)
Ans:
Since more than one user can access one database, there exists the need to
restrict user from using entire database in any way. Setting up access privilege can do
this. Any privilege can be granted to or revoked from user with taken of the GRANT and
REVOKE statements. Each privilege can be granted or revoked individually or in a
group. Such group of rights is called ROLE and rights can be granted or revoked into in
the same way as to the user. Access privileges include SELECT, INSERT, UPDATE and
DELETE.
GRANT {statement|role_name} ON {object_name} TO {user|role_name_2} [WITH
GRANT OPTION]
statement
role_name
object_name
user
role_name_2
WITH GRANT
OPTION
Q.101
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.102
Differentiate between
(i)
Procedural and non procedural DML
(ii)
Forms based and graphical interface
(iii)
Internal and external schema
(4 x 3 = 12)
Ans (i) Procedural and non procedural DML Procedural DML specify what data is
needed and how to get those data. Non procedural DML specify what data is needed
without specifying how to get those data.
(ii) Forms based and graphical interface: graphical user interface (GUI) is a type of
user interface which allows people to interact with electronic devices like computers,
hand-held devices (MP3 Players, Portable Media Players, and Gaming devices),
household appliances and office equipment. A GUI offers graphical icons, and visual
indicators as opposed to text-based interfaces, typed command labels or text navigation to
fully represent the information and actions available to a user. The actions are usually
performed through direct manipulation of the graphical elements.
Forms-based applications are inherently less usable and less functional than traditional
GUI-based applications.
(iii) Internal and external schema: Internal Schema
Describes the physical storage structure
Uses a physical data model
External Schema
Includes a number user views
Uses a conceptual or an implementation data model
Q.103
65
www.jntuworld.com
(8)
www.jntuworld.com
www.jwjobs.net
DC10
Q.104
relationship types.
(8)
Ans: Relationship types have certain constraints that limit the possible combination of
entities that may participate in relationship.
An example of a constraint is that if we have the entities Doctor and Patient, the
organization may have a rule that a patient cannot be seen by more than one doctor. This
constraint needs to be described in the schema.There are two main types of structural
relationship constraints on: cardinality ratio, and participation
Q.105
Discuss the techniques for a hash file to expand and shrink dynamically. What are the
advantages and disadvantages of each?
(8)
Ans:
The hashing techniques that allow dyanamic file expansion are:
(i) Extendible hashing
(ii) Linear hashing
The main advantage of extendible hashing that makes it attractive is that performance of
the file does not degrade as the file grows. Also, no space is allocated in extendible
hashing for future growth, but additional buckets can be allocated dynamically as needed.
A disadvantage is that the directory must be searched before accessing the buckets
themselves, resulting in two blocks accesses instead of one in static hashing.
Q.106
What are the reasons for having variable length records? What are the various ways to
store variable length records?
(4)
Ans:
Variable-length records arise in a database in several ways:
(i)Storage of multiple items in a file.
(ii)Record types allowing variable field size
(iii)Record types allowing repeating fields
66
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q107
(4)
Ans: Disk read/write heads are mechanisms that read data from or write data to disk
drives. The heads have gone through a number of changes over the years.
In a hard drive, the heads 'fly' above the disk surface with clearance of as little as 3
nanometres. The "flying height" is constantly decreasing to enable higher area density.
The flying height of the head is controlled by the design of an air-bearing etched onto the
disk-facing surface of the slider. The role of the air bearing is to maintain the flying
height constant as the head moves over the surface of the disk. If the head hits the disk's
surface, a catastrophic head crash can result.
The heads themselves started out similar to the heads in tape recorderssimple
devices made out of a tiny C-shaped piece of highly magnetizable material called ferrite
wrapped in a fine wire coil. When writing, the coil is energized, a strong magnetic field
forms in the gap of the C, and the recording surface adjacent to the gap is magnetized.
When reading, the magnetized material rotates past the heads, the ferrite core concentrates
the field, and a current is generated in the coil. The gap where the field is very strong is
quite narrow. That gap is roughly equal to the thickness of the magnetic media on the
recording surface. The gap determines the minimum size of a recorded area on the disk.
Ferrite heads are large, and write fairly large features.
Q.108
Q.109
(9)
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.110
Explain the difference between using functions with and without grouping attributes in
relational algebra. Give examples.
(6)
Ans:
Group functions are used to group data of similar type.
GAMMA = grouping and aggregation
Applying GAMMAL(R)
Group R according to all the grouping attributes on list L.
o That is: form one group for each distinct list of values for those attributes
in R.
Within each group, compute AGG(A ) for each aggregation on list L.
Result has one tuple for each group:
o The grouping attributes and
o Their groups aggregations.
Example: Grouping /Aggregation
R= (ABC)
1 2 3
4 5 6
1 2 5
GAMMAA,B,AVG(C) (R) = ?
First, group R by A and B :
ABC
123
125
456
Then, average C within groups:
A B AVG(C)
12 4
45 6
Q.111
(10)
68
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
(4)
Ans:
Generally, the data dictionary consists of base tables and user-accessible views.
The base tables contain all database information that is dynamically updated by Oracle
RDBMS. Oracle strictly discourages using those tables even for selects; the database
users normally have no access to them, and even DBAs do not typically query these
tables directly. The information stored in the base tables is cryptic and difficult to
understand. The user-accessible views summarize and display the information stored in
the base tables; they display the information from the base tables in readable and/or
simplified form using joins, column aliases, and so on. Different Oracle users can have
SELECT privileges on different database views.
Q.114
(6)
Ans:
The SGA is a collection of shared memory areas that along with the Oracle
processes constitute an Oracle instance. All SGA components allocate and deallocate
space in units of granules. Granule size is determined by total SGA size. On most
platforms, the size of a granule is 4 MB if the total SGA size is less than 1 GB, and
granule size is 16MB for larger SGAs. Some platform dependencies arise. For
example, on 32-bit Windows, the granule size is 8M for SGAs larger than 1GB
Q.115
(6)
Ans:
Stands for "Query By Example." QBE is a feature included with various
database applications that provides a user-friendly method of running database queries.
69
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.116
What three main types of actions involve databases? Briefly discuss these.
(6)
(6)
Q.119
Ans:
The functional components of a database system can be broadly divided
1) Storage manager and 2) query processor
1) Storage manager components includes:
70
www.jntuworld.com
into:
www.jntuworld.com
www.jwjobs.net
DC10
2)
Compiler and
Linker
Applcation
Prog.obj.code
DML queries
DDL Interpreter
D M L com puter
& organizer
Query
Processor
Query evaluation
engine
Buffer
Manager
Authorzsation
& Integrity
Manager
File
Manager
Transaction
Manager
Storage
Manager
Disk
Storage
Q.120
Ans: (i) Participation role: roles are indicating in E-R diagram by labelling the lines
that connect diamonds to rectangles.
(ii) Recursive relationship type: A recursive relationship is one in which the same
entity participates more than once in the relationship
(iii) Composite attribute: A composite attribute has multiple components, each of
which is atomic or composite.
(iv) Entity: A DBMS entity is either a thing in the modeled world or a drawing element
in an ERD.
Q.121
A database is to be constructed to keep track of the teams and games of a sport league. A
team has a number of players, not all of whom participate in each game. It is desired to
keep track of the players participating in each game of each team and the result of the
game.
71
www.jntuworld.com
www.jntuworld.com
DC10
www.jwjobs.net
DATABASE MANAGEMENT SYSTEMS
Create an ER diagram, completely with attributes, keys and constraints, for the above
description. State any assumptions that you make.
(8)
Ans:
Name
Name
Tid
mTea
Has
Tid
Players
Participated
n
Result
Game
Name
Q.122
Type
Discuss the types of integrity constraints that must be checked for the update operations
Insert and Delete. Give examples.
(8)
Ans: Insert operation can violet any of the following four constraints:
1) Domain constraints can be violated if given attribute value does not appear in
corresponding domain.
2) Key constraints can be violated if given attribute value does not appear in
corresponding domain.
3) Entity integrity can be violated if the primary key of the new tuple t is NULL.
4) Referential integrity can be violated if value of any foreign key in t refers to a tuple
that does not exist in referenced relation.
Delete operation can violate only referential integrity constraints, if the tuple being
deleted is referenced by the foreign keys from other tuples in the database.
Q.123
(12)
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.124
What is recursive closure? Why is it not possible to define this operation in relational
algebra?
(4)
A
a
a
b
B
15
25
15
73
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Count p
3
(iii)
A
a
A
a
a
a
b
b
R1 x R1.B>R2.Q R2
B
15
15
25
25
25
15
15
C
10
10
8
8
8
5
5
P
c
b
b
c
b
c
b
Q
10
5
15
10
5
10
5
R
8
6
5
8
6
8
6
(iv) R1 X R2
A
a
a
a
a
a
a
b
b
b
B
15
15
15
25
25
25
15
15
15
C
10
10
10
8
8
8
5
5
5
P
b
c
b
b
c
b
b
c
b
Q
15
10
5
15
10
5
15
10
5
R
10
8
6
5
8
6
5
8
6
Q.126
Explain the EXISTS and UNIQUE functions of SQL. Give an example for each.
(6)
Ans: EXISTS: The EXISTS function takes one parameter which is a SQL statement. If
any records exist that match the criteria it returns true, otherwise it returns false. This
gives you a clean, efficient way to write a stored procedure that does either an insert or
update.
UNIQUE: If UNIQUE is specified then only unique values are used to
calculate the mean.
Q.127
(4)
Ans: The NULL SQL keyword is used to represent either a missing value or a
value that is not applicable in a relational table.
Consider there is a relation:
Person(id, name, address, phone)
Now to find ids and names of person who do not have a phone is:
74
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.128
Describe substring comparison in SQL. For the relation Person(name, address), write a
SQL query which retrieves the names of people whose name begins with A and address
contains Bangalore.
(6)
Ans: SUBSTR is used to extract a set of characters from a string by specifying the
character starting position and end position and length of characters to be fetched.
example substr('hello',2,3) will return 'ell'
Select name
from Person
where name like A% and address = Bangalore
Q.129
Q.130
For the relations given in Q129 answer the following queries in SQL
(i) Get the names of persons who live in the street named Mahatma Gandhi.
(ii) Get the house numbers street wise.
(iii) Get the numbers of houses which are not occupied.
(9)
Ans: (i) Select lives.name from Street, House, Lives where Street.name =
House.street_name and House. Number = Lives. House_number and street_name =
Mahatma Gandhi;
(ii) Select number from House
order by street_name;
(iii) Select number from house
minus
Select house_number from lives;
Q.131
(8)
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.132
(8)
Ans: (i) CNT: It is one of the aggregation commands provide in QBE. It is used to
identify number of tuples
(ii) I : It is the command in QBE which is used to insert tuple (s) into the database
(iii) P: It is the command that is used to print (logically display) the value of the
attribute in whose cell it is written. To display the entire relation, P has to be written
in every field or by placing a single P in the column headed by the relation name also
displays entire relation.
(iv) D: It is the command in QBE to delete tuple(s) from the relation.
Q.133
Discuss the differences between the candidate keys and the primary key of a relation.
Give example to illustrate your answer.
Ans: A candidate key is one which can be used as primary key that is not null and
unique constraint both holding true. In short all primary keys are definitely candidate
keys. That is one of the candidate keys is chosen as primary key.
Q.134
(6)
Ans:
Data Definition language (DDL):A database schema is specified by a set of
definitions expressed by a special
language called data definition language. For
example, the following statement in the SQL defines the account table
Create table account (account_number char(10), balance integer)
Execution of the above DDL statement creates the account table. DDL allows a user to
specify storage structure and access methods used by the database system as well as
specify certain consistency constraints like balance of an account should on fall below
Rs1000.
Data Manipulation language (DML): A data-manipulation language (DML) is a
language that enables users to access or manipulate data as organized by the appropriate
data model.
76
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.135
Explain the terms primary key, candidate key, alternate key and secondary key. In the
given table identify each key.
(8)
STUDENT(SID,Regno, Name, City)
Ans:
Primary Key: The primary key of a relational table uniquely identifies each
record in the table. It can either be a normal attribute (or set of attributes) that is
guaranteed to be unique (such as Social Security Number in a table with no more than
one record per person) or it can be generated by the DBMS (such as a globally unique
identifier, or GUID, in Microsoft SQL Server).
Candidate Key: A candidate key is a combination of attributes that can be uniquely used
to identify a database record without any extraneous data. Each
table may have one
or more candidate keys. One of these candidate keys is selected as the table primary
key.
Alternate Key: An alternate key (or secondary key) is any candidate key which is not
selected to be the primary key (PK).
For example, a relational database with a table "employee" could have attributes like
"employee_id", "bank_acct_no", and so on. In this case, both "employee_id" and
"bank_acct_no" serve as unique identifiers for a given employee, and could thus
arguably be used for a primary key. Hence, both of them are called "candidate
keys". If, for example, "bank_acct_no" was chosen as the primary key, "employee_id"
would become the alternate key
Secondary Key: Same as above
In above table SID is a primary key, SID and Regno are candidate keys and SIDor
Regno are alternate or secondary key.
Q.136
In an organisation several projects are undertaken. Each projects can employ one or
more employees. Each employee can work on one or more projects.Each project is
undertaken on the request of client. A client can request for several projects. Each
project has only one client. A project can use a number of items and a item may be used
by several projects. Draw an E-R diagram and convert it to a relational schema.
(10)
77
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Use
m
Project
P name
Item
Work
I Type
n
Employee
E name
Pid
Empid
Request
l
Client
C name
C No.
Q.137
Define
(i) Identifying relationship.
(ii) Specialisation / generalization.
(iii) Aggregation.
(6)
Ans:
(i)
Identifying relationship: An identifying relationship means that the
child table cannot be uniquely identified without the parent. For example, you have this
situation in the intersection table used to resolve a many-to-many relationship where the
intersecting table's Primary Key is a composite of the left and right (parents) table's
Primary Keys
(ii) Specialisation / generalization: Generalization/Specialization represents the is a
relationship set, an essential element of the object oriented paradigm. The main idea
in Generalization/Specialization is that one object class (the specialization) is a
subset of another (the generalization).
(iii) Aggregation: Aggregation refers to an abstraction in which a relationship between
objects is regarded as a higher-level object.
Q.138
What is hash file organization? What are the causes of bucket overflow in a hash file
organization? What can be done to reduce the occurrence of bucket overflow?
(8)
78
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.139
Q.140
Ans:(i) EMPLOYEEEmp#(project#=comp33(ASSIGNED))
(ii)
Emp#(EMPLOYEE)-(ASSIGNED project#(PROJECT))
(iii) PROJECT(project#(Emp_name=RAM(EMPLOYEE)ASSIGNED))
Q.141
(4)
Ans:Outer joins return all rows from at least one of the tables or views mentioned in the
FROM clause, as long as those rows meet any WHERE or HAVING search conditions.
79
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.142
Ans:
Stud_id
Stud_name
date_of_birth
P._S
Q.143
Percent_marks
Dept_name
>80
Computer
Science
Department
Explain various kinds of constraints that can be specified using CREATE TABLE
command. Explain CASCADE and RESTRICT clauses of DROP SCHEMA command.
(7)
80
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Description
PRIMARY KEY Determines which column(s) uniquely identifies each record. The
primary key cannot be NULL, and the data value(s) must be unique.
FOREIGN KEY In a one-to-many relationship, the constraint is added to the "many"
table. The constraint ensures that if a value is entered into a
specified column, it must already exist in the "one" table, or the
record is not added.
UNIQUE
Ensures that all data values stored in a specified column are unique.
The UNIQUE constraint differs from the PRIMARY KEY
constraint in that it allows NULL values.
CHECK
NOT NULL
Prevents the DROP from taking place if any dependent objects exists (RESTRICT) or
causes all dependent objects do also be dropped (CASCADE).
Q.145
(4 4 = 16)
Ans:
(i)
In any data model, it is important to distinguish between the
description of the database and the database itself the description of a database is called
database schema, which is specified during database design and is not expected to
change frequently. The actual data in a database is database itself. May change quite
frequently.
The schema is sometimes called the intension, and a database state is called an
extension of the schema.
(ii)
Weak and Strong entity type: An entity set that does not have a primary key is
referred to as a weak entity set. The existence of a weak entity set depends on the
existence of a strong entity set; it must relate to the strong set via a on-to-many
relationship set. A discriminator of a weak entity set is the set of attributes that
distinguishes among all the entities of a weak entity set. The primary key of a weak entity
set is formed by the primary key of the strong entity set on which the weak entity set is
existence depends, plus the weak entity sets discriminator.
(iii) We define a view in SQL by using the create view command. To define a view, we
must give the view a name and must state the query that computers the view. The form of
the create view command is
Create view z as <query expression> where z is the view name
< query expression > is any legal query expression.
(iv) Built in function in QBE: QBE includes several built in functions like AVG,
MAX,MIN,SUM and CNT. We must prefix these operators with ALL to create a multiset
on which the aggregate operation is evaluated. The ALL operator ensures that duplicates
81
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.146
(8)
Q.148
(6)
Ans: Users are differentiated by the way they expect to interact with the system
(i) Application programmersinteract with system through DML calls
(ii) Sophisticated usersform requests in a database query language
(iii) Specialized userswrite specialized database applications that do not fit into
the traditional data processing framework
(iv) Naive usersinvoke one of the permanent application programs that have been
written previously Examples, people accessing database over the web, bank tellers,
clerical staff
Q.149
82
www.jntuworld.com
(8)
www.jntuworld.com
www.jwjobs.net
DC10
Q.150
What is an E-R model? Draw an E-R Diagram for the company database with following
Descriptions:
The company is organized into departments. Each department has a unique name and a
unique number with several locations.
A department controls a number of projects, each of which has a unique name, unique
number and a single location.
We store each employees name, social security number, address, and salary. An
employee is assigned to one department but may work on several projects, which are not
necessarily controlled by the same departments.
We want to keep track of the dependents of each employee for insurance purposes. We
keep each dependents name, age and relationship to the employee.
(8)
Ans:
An entity-relationship model (ERM) is an abstract conceptual representation of
structured data. Entity-relationship modeling is a relational schema database modeling
method, used in software engineering to produce a type of conceptual data model (or
semantic data model) of a system, often a relational database, and its requirements in a
top-down fashion. Diagrams created using this process are called entity-relationship
diagrams, or ER diagrams or ERDs for short.
83
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.151
(i)
(ii)
(8)
Ans:(i)
Record-Based logical Models: Also describe data at the conceptual and
view levels. Unlike object-oriented models, are used to specify overall logical structure of
the database, and provide a higher-level description of the implementation. Named so
because the database is structured in fixed-format records of several types. Each record
type defines a fixed number of fields, or attributes. Each field is usually of a fixed length
(this simplifies the implementation). Record-based models do not include a mechanism
for direct representation of code in the database. Separate languages associated with the
model are used to express database queries and updates. The three most widely-accepted
models are the relational, network, and hierarchical.
(ii) Data Independence: Techniques that allow data to be changed without affecting
the applications that process it. There are two kinds of data independence. The first type is
data independence for data, which is accomplished in a database management system
(DBMS). It allows the database to be structurally changed without affecting most existing
programs. Programs access data in a DBMS by field and are concerned with only the data
fields they use, not the format of the complete record. Thus, when the record layout is
updated (fields added, deleted or changed in size), the only programs that must be
changed are those that use those new fields.
84
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.152
What is bucket overflow and how bucket overflow is handled by Over Flow Chaining or
Closed Hashing?
(8)
Ans:
Bucket: unit of storage containing records. Bucket is a disk block or contiguous
block .Bucket contains multiple records .
Hash Function: maps records to bucket numbers Function h from set of all search
key values K to the set of all bucket addresses(numbers) B .Records with different search
key values may be mapped same bucket. Entire bucket has to be searched to locate
record.If bucket is full need overflow buckets and pointers
How to handle bucket overflow:
Buckets overflow is handled by using overflow buckets
o Closed Hashing (Chaining): The overflow buckets of a given bucket are chained
together in a linked list
o Open Hashing: place in next available bucket (not suitable for database
applications)
o Multiple Hashing : use a second hash function
Q.153
What are the Constituents of File? Also explain all the possible file operations.
(8)
Ans:
A file is organised logically as sequence of record. These records are mapped
onto disk blocks. Although blocks are of fixed size determined by the physical properties
of the disk and by the operating system, record sizes vary. In a relational database, tuples
of distinct relations are generally of different sizes.
Possible operations on a file:
(i) Create: a file can be created
(ii) Delete: a file can be deleted
(iii) Changing attributes of a file: The attributes of a file say read only, authors name
etc. can be changed.
(iv) Contents of the file can be altered.
Q.154
Express the following queries in SQL assumes that the data is stored in EMPLOYEE
table with relevant fields.
(i) Display name, job, salary, and hire date of employee who are hired between May
10, 1975 and December 20, 1980. Order the query in ascending order of hire date.
(ii) Display name and hire date of employee who are employed after employee
RAGHAV.
(6)
What are the various types of the update operations on relations? Also explain the
constraints on these update operation. Give examples in support of your answer. (10)
85
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Ans:
Q.156
Explain the SQL operators BETWEEN-AND, IN, LIKE and IS_NULL by taking suitable
examples.
(8)
86
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
LIKE
IN
column value does not exist. Eg, SQL statement to find all
salesperson who are not earning any commission:
IS NULL
Select * from employee where job= Sales and commission is
null.
Q.158
(i)
Relational Constraints are:
NOT NULL
Unique
Primary key
Foreign key
Table check
(ii)
Disadvantages of relational approach:
Substantial hardware and system software overhead
May not fit all business models
Can facilitate poor design and implementation
87
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.159
(8)
Ans:
Key features of Oracle are as follows:
Read Consistency
Concurrency
Locking Mechanisms
Quiesce Database
RAC
Portability
Q.160
(8)
Ans:
(i)
To_char( ): The TO_CHAR function converts a DATETIME, number,
or NTEXT expression to a TEXT expression in a specified format. This function is
typically used to format output data.
(ii) Count( ): The COUNT function returns the number of rows in a query.
The syntax for the COUNT function is:
SELECT COUNT (expression)
FROM tables
WHERE predicates;
(iii) Trim( ): In Oracle/PLSQL, the trim function removes all specified characters either
from the beginning or the ending of a string.
The syntax for the trim function is:
trim( [ leading | trailing | both [ trim_character ] ] string1 )
leading - remove trim_string from the front of string1.
trailing - remove trim_string from the end of string1.
both - remove trim_string from the front and end of string1.
(iv) Length( ): In Oracle/PLSQL, the length function returns the length of the specified
string.
The syntax for the length function is:
length(string1)
string1 is the string to return the length for. If string1 is NULL, then the function returns
NULL.
Q.161
Ans:
Disadvantages of File Processing Systems include:
1) Data Redundancy
2) Data Inconsistency
3) Difficult to access data
4) Data isolation
5) Atomicity problem
88
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Q.162
What is data model? Explain object based and record based data models.
Ans:
A data model is an abstract model that describes how data is represented and
accessed.
(i) Object based data models: Similar to a relational database model, but objects,
classes and inheritance are directly supported in database schemas and in the query
language
(ii) Record based data models: is a database model based on first-order predicate
logic. Its core idea is to describe a database as a collection of predicates over a finite set
of predicate variables, describing constraints on the possible values and combinations of
values.
Q.163
How is Oracle used in PL/SQL? Define the features of procedures and how they are
defined.
(7)
Ans:
PL/SQL PL/SQL is Oracles procedural language (PL) superset of the Structured
Query Language (SQL). PL/SQL is block-structured language that enables developers to
code procedures, functions and unnamed blocks that combine SQL with procedural
statements. PL/SQL has its own processing engine that executes PL/SQL blocks and
subprograms. If the host program does not have the PL/SQL engine, the blocks of code
are sent to the Oracle server for processing. The following figure shows the PL/SQL
engine as an integrated component of Oracle server. The engine executes procedure
statements and passes SQL statements to the SQL statement executor in the Oracle
server.
PL/SQL Engine
PL/SQL Block
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
Ans:
Organization
Works
bar
Time_Reported
Fault_id
Person
Assign
Time_Fixed
Fault
m
Person_ID
Q.164
Qty_ used
Repair
Has
Equipment
Consists
of
Location
Item
Contains
Detailed
discription
Type
90
www.jntuworld.com
Part_Id
Weight
Part
Max_Dimension
Colour
www.jntuworld.com
www.jwjobs.net
DC10
Q.165
Explain the concept of generalization and aggregation in E_R diagrams. Give one
example for each one of them.
Ans: Generalization: Consider extending the entity set account by classifying accounts
as being either savings-account or chequing-account.
Each of these is described by the attributes of account plus additional attributes.
(savings has interest-rate and chequing has overdraft-amount.)
We can express the similarities between the entity sets by generalization. This is the
process of forming containment relationships between a higher-level entity set and one or
more lower-level entity sets.
Aggregation: The E-R model cannot express relationships among relationships.
When would we need such a thing?
Consider a DB with information about employees who work on a particular project and
use a number of machines doing that work. We get the E-R diagram shown in Figure 1.
na me
ho ur s
id
e mp lo ye e
wo r k
n u mb e r
p r o j ect
u ser s
ma c hi n er y
id
91
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
DC10
ho ur s
id
e mp lo ye e
wo r k
u ser s
ma c hi n er y
id
92
www.jntuworld.com
n u mb e r
p r o j ect