Database Lab :- Viva questions
1. What is database?
A database is a logically related collection of data with some inherent meaning, representing
some aspect of real world and which is designed, built and populated with data for a specific
purpose.
2. What is DBMS?
It is a collection of programs(software) that enables user to create and maintain a database. In
other words it is general-purpose software that provides the users with the processes of defining,
constructing and manipulating the database for various applications.
3. What is a Database system?
The database and DBMS software together is called as Database system.
4. What are the advantages of DBMS?
1. Redundancy is controlled.
2. Unauthorised access is restricted.
3. Providing multiple user interfaces.
4. Enforcing integrity constraints.
5. Providing backup and recovery.
5. What are the disadvantage in File Processing System?
1. Data redundancy and inconsistency.
2. Difficult in accessing data.
3. Data isolation.
4. Data integrity.
5. Concurrent access is not possible.
6. Security Problems.
6. Describe the three levels of data abstraction?
The are three levels of abstraction:
1. Physical level: The lowest level of abstraction describes how data are stored.
2. Logical level: The next higher level of abstraction, describes what data are stored in database
and what relationship among those data.
3. View level: The highest level of abstraction describes only part of entire database.
7. Define the "integrity rules"?
There are three Integrity rules.
1.Domain integrity: Explains about check constraint
2. Entity Integrity: States that "Primary key cannot have NULL value"
3. Referential Integrity: States that "Foreign Key can be either a NULL value or should be
Primary Key value of other relation.
8. What is Data Independence?
Data independence means that "the application is independent of the storage structure and access
strategy of data". In other words, The ability to modify the schema definition in one level should
not affect the schema definition in the next higher level.
Two types of Data Independence:
1. Physical Data Independence: Modification in physical level should not affect the logical
level.
2. Logical Data Independence: Modification in logical level should affect the view level.
9. What is a view? How it is related to data independence?
A view may be thought of as a virtual table, that is, a table that does not really exist in its own
right but is instead derived from one or more underlying base table. In other words, there is no
stored file that direct represents the view instead a definition of view is stored in data dictionary.
10. What is Data Model?
A collection of conceptual tools for describing data, data relationships data semantics and
constraints.
11. What is E-R model?
This data model is based on real world that consists of basic objects called entities and of
relationship among these objects. Entities are described in a database by a set of attributes.
12. What is Object Oriented model?
This model is based on collection of objects. An object contains values stored in instance
variables with in the object. An object also contains bodies of code that operate on the object.
These bodies of code are called methods. Objects that contain same types of values and the same
methods are grouped together into classes.
13. What is an Entity?
It is a 'thing' in the real world with an independent existence.
14. What is an Entity type?
It is a collection (set) of entities that have same attributes.
15. What is an Entity set?
It is a collection of all entities of particular entity type in the database.
16. What is Weak Entity set?
An entity set may not have sufficient attributes to form a primary key, and its primary key
compromises of its partial key and primary key of its parent entity, then it is said to be Weak
Entity set.
17. What is an attribute?
It is a particular property, which describes the entity.
18. What is a Relation Schema and a Relation?
A relation Schema denoted by R(A1, A2, ..., An) is made up of the relation name R and the list
of attributes Ai that it contains. A relation is defined as a set of tuples. Let r be the relation which
contains set tuples (t1, t2, t3, ..., tn). Each tuple is an ordered list of n-values t=(v1,v2, ..., vn).
19. What is degree of a Relation?
It is the number of attribute of its relation schema.
20. What is Relationship?
It is an association among two or more entities.
21. What is Relationship set?
The collection (or set) of similar relationships.
22. What is Relationship type?
Relationship type defines a set of associations or a relationship set among a given set of entity
types.
23. What is degree of Relationship type?
It is the number of entity type participating.
24. What is DDL (Data Definition Language)?
A data base schema is specifies by a set of definitions expressed by a special language called
DDL.DDL statements are:
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
25. What is DML (Data Manipulation Language)?
This language that enable user to access or manipulate data as organised by appropriate data
model.
1. Procedural DML or Low level: DML requires a user to specify what data are needed and
how to get those data.
2. Non-Procedural DML or High level: DML requires a user to specify what data are needed
without specifying how to get those data
Eg: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
26. What is DCL?
Data Control Language (DCL) statements. Some examples:
o GRANT - gives user's access privileges to database
o REVOKE - withdraw access privileges given with the GRANT command
27.What is TCL?
Transaction Control (TCL) statements are used to manage the changes made by DML
statements. It allows statements to be grouped together into logical transactions.
o COMMIT - save work done
o SAVEPOINT - identify a point in a transaction to which you can later roll back
o ROLLBACK - restore database to original since the last COMMIT
o SET TRANSACTION - Change transaction options like isolation level and what rollback
segment to use
28. What is DML Compiler?
It translates DML statements in a query language into low-level instruction that the query
evaluation
engine can understand.
29. What is DDL Interpreter?
It interprets DDL statements and record them in tables containing metadata.
30. What is Relational Algebra?
It is procedural query language. It consists of a set of operations that take one or two relations as
input and produce a new relation.
31. What is Relational Calculus?
It is an applied predicate calculus specifically tailored for relational databases proposed by E.F.
Codd.
E.g. of languages based on it are DSL ALPHA, QUEL.
32. What is normalization?
Normalization is a process of eliminating inconsistency, ambiguity , redundancy and anomalies
like insert anomaly,update anomaly and delete anomaly from the database .It is the process of
efficiently organizing data in a database.
33. What is Functional Dependency?
A functional dependency (FD) denoted by X→Y between 2 sets of attributes X and Y that are
subsets of R specifies a constraint on the possible tuples that can form a relation state r of R. the
constraint is that for any two tuples t1 and t2 in r that have t1[X]=t2[X], we must also have
t1[Y]= t2[Y].
34. What is Lossless join property?
It guarantees that the spurious tuple generation does not occur with respect to relation schemas
after decomposition.
35. What is 1 NF (Normal Form)?
The domain of attribute must include only atomic (simple, indivisible) values.
36. What is Fully Functional dependency?
In a functional dependency X →Y , if Y X then it is a trivial FD.Otherwise it is non
trivial.
37. What is 2NF?
A relation is said to be in Second Normal Form if and only If :
It is in the first normal form ,and
No partial dependency exists between non-key attributes and key attributes.
38. What is 3NF?
A relation R is said to be in 3NF if and only if
It is in 2NF
No transitive dependency exists between non-key attributes and key attributes.
39. What is BCNF (Boyce-Codd Normal Form)?
A row is in Boyce Codd normal form if, and only if, every determinant is a candidate key
40. What is 4NF?
A table is in 4NF if and only if,
It is in 3NF
Has no multiple sets of multi-valued dependencies. In other words, 4NF states that no
entity can have more than a single one-to-many relationship within an entity if the one-to-
many attributes are independent of each other.
Many:many relationships are resolved independently.
41. What is 5NF?
An entity is in Fifth Normal Form (5NF) if, and only if, it is in 4NF and every join dependency
for the entity is a consequence of its candidate keys.or for all join dependencies at least one of
the following holds:
-R1,R2,……………..Rn is a trivial join dependency
-Every Ri is a candidate key for R
It is also knownas Project Join Normal Form(PJNF)
42. What are primary,candidate,partial, alternate key,super key?
1. Primary key : uniquely identifies each record in a database table.
2. It is a set of attributes that are eligible to be a primary key.
3. Partial Key: It is a set of attributes that can uniquely identify weak entities and that are
related to same owner entity. It is sometime called as Discriminator.
4. Alternate Key: All Candidate Keys excluding the Primary Key are known as Alternate Keys.
5.Super key: A superkey is a combination of attributes that can be uniquely used to identify a
database record. A table might have many superkeys.
43. What is indexing and what are the different kinds of indexing?
Indexing is a technique for determining how quickly specific data can be found.
Types:
1.Ordered indices
2. Hash indices
44. What is system catalog or catalog relation? How is better known as?
A RDBMS maintains a description of all the data that it contains, information about every
relation and index that it contains. This information is stored in a collection of relations
maintained by the system called metadata. It is also called data dictionary.
45. What is meant by query optimization?
The phase that identifies an efficient execution plan for evaluating a query that has the least
estimated cost is referred to as query optimization.
46. What is durability in DBMS?
Once the DBMS informs the user that a transaction has successfully completed, its effects should
persist even if the system crashes before all its changes are reflected on disk. This property is
called durability.
47. What do you mean by atomicity and aggregation?
1. Atomicity: Either all actions are carried out or none are. Users should not have to worry
about the effect of incomplete transactions. DBMS ensures this by undoing the actions of
incomplete transactions.
2. Aggregation: A concept which is used to model a relationship between a collection of entities
and relationships. It is used when we need to express a relationship among relationships.
48. What is a checkpoint and When does it occur?
A Checkpoint is like a snapshot of the DBMS state. By taking checkpoints, the DBMS can
reduce the amount of work to be done during restart in the event of subsequent crashes.
49. What are the different phases of transaction?
Different phases are
1.) Analysis phase,
2.) Redo Phase,
3.) Undo phase.
50. What is "transparent DBMS"?
It is one, which keeps its Physical Structure hidden from user.
51. What is a query?
A query with respect to DBMS relates to user commands that are used to interact with a data
base.The query language can be classified into data definition language and data manipulation
language.
52. What do you mean by Correlated subquery?
Subqueries, or nested queries, are used to bring back a set of rows to be used by the parent query.
Depending on how the subquery is written, it can be executed once for the parent query or it can
be executed once for each row returned by the parent query. If the subquery is executed for each
row of the parent, this is called a correlated subquery.
A correlated subquery can be easily identified if it contains any references to the parent subquery
columns in its WHERE clause. Columns from the subquery cannot be referenced anywhere else
in the parent query. The following example demonstrates a non-correlated subquery.
Example: Select * From CUST Where '10/03/1990' IN (Select ODATE From ORDER
Where CUST.CNUM = ORDER.CNUM)
53. What are the primitive operations common to all record management systems?
Addition, deletion and modification.
54. Name the buffer in which all the commands that are typed in are stored?
'Edit' Buffer.
55. What are the unary operations in Relational Algebra?
PROJECTION and SELECTION.
56. Difference between CARTESIAN PRODUCT and JOIN operation the same?
CARTESIAN PRODUCT: Concatenation of every row in one relation with every row in
another.
JOIN: Concatenation of rows from one relation and related rows from another.
57. What is the job of the information stored in data-dictionary?
The information in the data dictionary validates the existence of the objects, provides access to
them,
and maps the actual physical storage location.
58. Define SQL and state the differences between SQL and other conventional
programming
Languages.
SQL is a nonprocedural language that is designed specifically for data access operations on
normalized relational database structures. The primary difference between SQL and other
conventional programming languages is that SQL statements specify what data operations should
be performed rather than how to perform them.
59. What is database Trigger?
A Trigger is a named database object which defines some action that the database should take
when some databases related event occurs. Triggers are executed when you issues a data
manipulation command like INSERT, DELETE, UPDATE on a table for which the trigger has
been created. They are automatically executed and also transparent to the user.
60. What are stored-procedures? And what are the advantages of using them?
Stored procedures are database objects that perform a user defined operation. A stored procedure
can have a set of compound SQL statements. A stored procedure executes the SQL commands
and returns the result to the client. Stored procedures are used to reduce network traffic.
61. What is Transaction Manager?
It is a program module, which ensures that database, remains in a consistent state despite system
failures and concurrent transaction execution proceeds without conflicting.
62. What are cursors give different types of cursors?
PL/SQL uses cursors for all database information accesses statements. The language supports the
use
two types of cursors
1.) Implicit
2.) Explicit
63. What are cursor attributes?
%ISOPEN,%FOUND,%NOTFOUND,%ROWCOUNT
64.Which are the SQL aggregate functions?
COUNT: computes the number of rows in a table.
SUM: totals numeric columns.
AVG: computes the average value.
MAX: obtains the maximum value of a column in a table.
MIN: obtains the minimum value of a column in a table.
65. What is a foreign key, and what is it used for?
A foreign key is used to establish relationships among relations in the relational model.
Technically, a foreign key is a column (or columns) appearing in one relation that is (are) the
primary key of another table. Although there may be exceptions, the values in the foreign key
columns usually must correspond to values existing in the set of primary key values. This
correspondence requirement is created in a database using a referential integrity constraint on the
foreign key.
66. Explain the difference between an exclusive lock and a shared lock.
An exclusive lock prohibits other users from reading the locked resource; a shared lock allows
other
users to read the locked resource, but they cannot update it.
67. What are the major functions of the database administrator?
Managing database structure, controlling concurrent processing, managing processing rights and
responsibilities, developing database security, providing for database recovery, managing the
DBMS and maintaining the data repository.
68. Explain what we mean by an ACID transaction.
An ACID transaction is one that is atomic, consistent, isolated, and durable. Durable means that
database changes are permanent. Consistency can mean either statement level or transaction
level consistency. With transaction level consistency, a transaction may not see its own changes.
There are four transaction isolation levels: read committed, read uncommitted, repeatable read
and serialization.Atomic means it is performed as a unit.
69. What are sequences?
A sequence is an object that generates a sequential series of unique numbers.
70. Describe concurrency control.
Concurrency control is the process managing simultaneous operations against a database so that
database integrity is not compromised. There are two approaches to concurrency control. The
pessimistic approach involves locking and the optimistic approach involves versioning.
71. Explain locking.
Locking is denying others the ability to update a record until someone completes the update or
releases the record. Locking can occur on many different levels in a database. It can occur at the
database, table, record, or field level. A lock can be shared (another can read the record while an
update is in progress) or exclusive (no one can read the record while an update is in progress).
72. Describe the difference between homogeneous and heterogeneous distributed
database.
A homogenous database is one that uses the same DBMS at each node. Either each node can
work independently or a central DBMS may coordinate database activities. A heterogeneous
database is one that may have a different DBMS at each node. It may support some or all of the
functionality of one logical database.
73. What is a distributed database?
A distributed database is a single logical database that is spread across more than one node or
locations that are all connected via some communication link. It requires multiple DBMSs,
running at each remote site.
74. What is the difference between horizontal and vertical partitioning?
Horizontal partitioning is where some rows of a table are placed into the base relations at one site
and other rows are placed at another site. Vertical partitioning is where some columns of a table
are placed into the base relations at one site and other columns are placed at another site but
each all of these relations must share a common domain.
75.What is an assertion?
1. An assertion is a predicate expressing a condition we wish the database to always satisfy.
2. Domain constraints, functional dependency and referential integrity are special forms of
assertion.