ELNing 4
ELNing 4
Q. 1. What is database?
Ans. A database is a logically coherent 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.
Q. 2. What is DBMS?
Ans. It is a collection of programs that enables user to create and maintain a database. In other
words it is gereral-purpose software that provides the users with the processes of defining,
constructing and manipulating the database for various applications.
Q. 3. What is a Database system?
Ans. The database and DBMS software together is called as Database system.
Q. 4. Advantages of DBMS?
Ans. (i) Redundancy is controlled.
(ii) Unauthorised access is restricted.
(iii) Providing multiple user interfaces.
(iv) Enforcing integrity constraints.
(v) Providing backup and recovery.
Q. 5. Disadvantage in File Processing System?
Ans. (i) Data redundancy and inconsistency.
(ii) Difficult in accessing data.
(iii) Data isolation.
(iv) Data integrity.
(v) Concurrent access is not possible. (vi) Security problems.
Q. 6. Describe the three levels of data abstraction ?
Ans. There are three levels of abstraction
(i) Physical level : The lowest level of abstraction describes how data are stored.
(ii) Logical level : The next higher level of abstraction, describes what data are stored in database
and what relationship among those data.
(iii) View level :The highest level of abstraction describes only part of entire database.
Q. 7. Define the "integrity rules"
Ans. There are two Integrity rules.
(i) Entity Integrity : States that "Primary key cannot have NULL value"
(ii) Referential Integrity : States that "Foreign Key can be either a NULL value or should be Primary
Key value of other relation.
Q. 8. What is extension and intension?
Ans. Extension—It is the number of tuples present in a table at any instance. This is time
dependent.
Intension —It is a constant value that gives the name, structure of table and the constraint laid on it.
285 DATABASE MANAGEMENT SYSTEMS
Ans. It translates DML statements in a query language into low-level instruction that the query
evaluation engine can understand.
Q. 34. What is Query evaluation engine?
Ans. It executes low-level instruction generated by compiler.
Q. 35. What is DDL Interpreter?
Ans. It interprets DDL statements and record them in tables containing metadata.
Q. 36. What is Record-at-a-time-?
Ans. The low level or Procedural DML can specify and retrieve each record from a set of records.
This retrive of a record is said to be Record-at-a-time.
Q. 37. What is Set-at-a-time or Set-oriented?
Ans. The High level or Non-procedural DML can specify and retrive many records in a single DML
statement. This retrieve of a record is said to be set-at-a-time or Set-oriented.
Q. 38. What is Relational Algebra?
Ans. 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.
Q. 39. What is Relational Calculus?
Ans. 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.
Q. 40. How does Thple-oriented relational calculus differ from domain-oriented relational
calculus ?
Ans. The tuple-oriented calculus uses a tuple variables, i.e., variable whose only permitted values
are tuples of that relation, e.g., QUEL.
The domain-oriented calculus has domain variables, i.e., variables that range over the underlying
domains instead of over relation, e.g., ILL, DEDUCE.
Q. 41. What is normalization?
Ans. It is a process of analysing the given relation schemas based on their Functional Dependencies
(FDs) and primary key to achieve the properties (i) Minimizing redundancy
(ii) Minimizing insertion, deletion amd update anomalies.
Q. 42. What is Functional Dependency?
Ans. A Functional dependency is denoted by X Y between two sets of attributes X and Y that are
subsets of R specifies a constraint on the possible tuple that can form a relation state r of R. The
constraint is for any two tuples tl and t2 in r if t I[X] = t 2[Xl then they have t I[Y] = t 2[Y]. This
means the value of X component of a tuple uniquely determines the value of component Y.
Q. 43. When is a functional dependency F said to be minimal?
Ans. (i) Every dependency in F has a single attribute for its right hand side. (ii). We cannot replace
any dependency X A in F with a dependency Y A where Y is a proper subset of x and still have a
set of dependency that is equivalent to F.
(iii) We cannot remove any dependency from F and still have set of dependency that is equivalent
to F.
Q. 44. What is Multivalued dependency?
APPENDIX-D 288
Ans. Multivalued dependency denoted by X Y specified on relation schema R, where X and Y are
both subsets of R, specifies the following constraint on any relation r of R: if two tuples t 1 and t2
exist in r such that t I[X] t 2[X] then t3 and t4 should also exist in r with the following propertics
Ans. Relational Data Base Management Systems (RDBMS) are database management systems that
maintain data records and indices in tables. Relationships may be created and maintained across and
among the data and tables. In a relational database, relationships between data items are expressed
by means of tables. Interdependencies among these tables are expressed by data values rather than
by pointers. This allows a high degree of data independence. An RDBMS has the capability to
recombine the data items from different files, providing powerful tools for data usage.
Q. 54. What is Stored Procedure?
Ans. A stored procedure is a named group of SQL statements that have been previously created and
stored in the server database. Stored procedures accept input parameters so that a single procedure
can be used over the network by several clients using different input data. And when the procedure
is modified, all clients automatically get the new version. Stored procedures reduce network traffic
and improve performance. Stored pocedures can be used to help ensue the integrity of the database.
e.g. sp_helpdb. sp_renamedb, sp.depends etc.
Q. 55. What is cursors?
Ans. Cursor is a database object used by applications to manipulate data in a set on a row-by-row
basis, instead of the typical SOL commands that operate on all the rows in the set at one time.
In order to work with a cursor we need to perform some steps in the following order :
Declare cursor
Open cursor
Fetch row from the cursor
Process fetched row
Close cursor
Deallocate cursor
Q. 56. What it 'frigger?
Ans. A trigger is a SOL procedure that initiates an action when an event (INSERT, DELETE or
UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain
the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be
called or executed; the DBMS automatically fires the trigger as a result of a data modification to the
associated table. Triggers can be viewed as similar to stored procedures in that both consist of
procedural logic that is stored at the database level. Stored procedures, however, are not event-drive
and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by
invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can
also execute stored procedures.
Nasted Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so
when the trigger is fired because of data modification it can also cause another data modification,
thereby firing another trigger. A trigger that contains data modification logic within itself is called a
nested trigger.
Q. 57. What is View?
Ans. A simple view can be thought of as a subset of a table. It can be used for retrieving data, as
well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the
table the view was created with. It should also be noted that as data in the original table changes, so
does data in the view, as views are the way to look at part of the original table. The results of using
a view are not permanently stored in the database. The data accessed through a view is actually
constructed using standard T-SQL select command and can come from one to many different base
tables or even other views.
APPENDIX-D 290
powerful, are sometimes not efficient enough or do not provide the level of control
necessary for application development. When these tools are not adequate, DBMSs
provide the full capabilities of a programming language. A procedural language interface combines
a non-procedural language such as COBOL or Visual Basic.
Q. 65. What is a transaction?
Ans. A transaction is a unit of work that should be processed reliably without interference from
other users and without loss of data due to failures. Examples of transactions are withdrawing cash
at an ATM, making an airline reservation, and registering for a course.
Q. 66. What features does a DBMS provide to support transaction processing?
Ans. A DBMS ensures that transactions are free of interference from other users, parts of a
transaction are not lost due to a failure, and transactions do not make the database
inconsistent. Transaction processing is largely a "behind the scenes" affair. The user does not know
the details about transaction processing other than the assurances about reliability.
Q. 67. What is an enterprise DBMS?
Ans. An enterprise DBMS supports databases that are often critical to the functioning of an
organization. Enterprise DBMSs usually run on powerful servers and have a high cost. Q. 68. What is
a desktop DBMS?
Ans . A desktop DBMS runs on personal and small servers. It supports limited transaction
processing features but has a much lower cost then an enterise DBMS. Desktop DBMSs support
databases used by work teams and small businesses .
Q. 69. What were the prominent features of first generation DBMSs?
Ans. File structures and proprietary program interfaces were the prominent features of first
generation database software.
Q. 70. What were the prominent features of second generation DBMSs ?
Ans. Networks and hierarchies of related records along with standard program interfaces
were the prominent features of second generation database software.
Q. 71. What were the prominent features of third generation DBMSs ?
Ans. Non -procedural languages, optimization, and transaction processing were the prominent
features of third generation database software.
Q. 72. What are the prominent features of fourth generation DBMSs ?
Ans. Support for multi-media data, active databases, data warehouses, and distributed processing
are the prominent features of generation database software.
Q. 73. For the database you described in question 1, make a table to depict differences among
schema levels. Use Table 1-4 as a guide. Ans.
Schema level Description
External The registration form View, the report of grade View, the faculty assignment
form View, and the report of faculty workload View
APPENDIX-D 292
Ans. Delete command removes the rows from a table based on the condition that we provide with a
WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in
the table after we run the truncate command.
TRUNCATE
• TRUNCATE is faster and uses fewer system and transaction log resources than DELETE.
• TRUNCATE removes the data by deallocating the data pages used to store the table's data, and
only the page deallocations are recorded in the transaction log.
• TRUNCATE removes all rows from a table, but the table structure and its columns,
constraints, indexes and so on remain. The counter used by an identity for new rows is reset to
the seed for the column.
• You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint.
Because TRUNCATE TABLE is not logged, it cannot activate a trigger.
• TRUNCATE can not be Rolled back.
• TRUNCATE is DDL Command. • TRUNCATE resets identity of the table.
DELETE
• DELETE remove rows one at a time and records an entry in the transation log for each deleted
row. If you want to retain the identity counter, use DELETE instead. If you want to remove
table definition and its data, use the DROP TABLE statement.
• DELETE can be used with or without a WHERE clause DELETE Activates Triggers.
• DELETE can be rolled back.
• DELETE is DML Command.
• DELETE does to reset identity of the table.
Q. 81. When is the use of UPDATE STATISTICS command?
Ans. This command is basically used when a large processing of data has occurred. If a large
amount of deletions, any modification or Bulk Copy into the tables has occurred, it has to update
the indexes to take these changes into account. UPDATE STATISTICS updates the indexes on
these table accordingly.
Q. 82. What types of joins are possible with SQL Server? Ans. Joins are used in queries to explain
how different tables are related. Joins also let you select data from a table depending upon data
from another table.
Types of Joins : INNER JOINs, OUTER JOINs, NATURAL JOINs, OUTER JOINs are further
classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS
Q. 83. What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
Ans. Specifies a search condition for a group or an aggregate. Having can be used only with the
SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not
used, HAVING behaves like a WHERE clause. Having clause is basically used only with the
GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the
GROUP BY function in a query.
Q. 84. What is sub-query? Explain properties of sub-query.
APPENDIX-D 294
Ans. Sub-queries are often referred to as sub-selects, as they allow a SELECT statement to be
executed arbitrarily within the body of another SQL statement. A sub-query is executed by
enclosing it in a set of parentheses. Sub-queries are generally used to return a single row as an
atomic value, though they may be used to compare values against multiple rows with the IN
keyword.
A sub query is a SELECT statement that is nested within another T-SQL statement. A sub query
SELECT statement if executed independently of the T-SQL statement, in which it is nested, will
return a result set. Meaning a sub query SELECT statement can standalone and is not depended on
the statement in which it is nested. A sub query SELECT statement can return any number of
values, and can be found in the column list of a SELECT statement, a FROM, GROUP BY,
HAVING, and or ORDER BY clauses of a T-SQ statement. A Sub query anywhere an expression
can be used.
Properties of Sub-Query
• A sub query must be enclosed in the parenthesis.
• A sub query must be put in the right hand of the comparison operator, and
• A sub query cannot contain an ORDER-BY clause. ' A query can contain more than one sub-
queries. Q. 85. What are types of sub-queries?
Ans. Single-row sub query, where the sub query returns only one row.
Multiple-row sub query, where the sub query returns multiple rows, and Multiple
column sub query, where the sub query returns multiple columns.
Q. 86. What is log shipping?
Ans. Log shipping is the process of automating the backup of database and transaction log files on a
production SQL server, and then restoring them onto a standby server. Enterprise Editions only
supports log shipping. In log shipping the transactional log file from one server is automatically
updated into the backup database on the other server.
If one server fails, thc other server will have the same databasc can be used this as the Disaster
Recovery plan. The key feature of log shipping is that is will automatically backup transaction logs
throughout the day and automatically restore them on the standby server at defined interval.
Q. 87. What is the difference between a local and a global variable?
Ans. A local temporary table exists only for the duration of a connection or, if defined inside a
compound statement, for the duration of the compound statement.
A global temporary table remains in the database permanently, but the rows exist only within a
given connection. When connection are closed, the data in the global temporary table disappears.
However, the table definition remains with the database for access when database is opened next
time.
Q. 88. What are the properties of the Relational tables?
Ans. Relation tables have six properties :
Values are atomic.
Column values are of the same kind.
Each row is unique
The sequence of columns is insignificant.
Each column must have a unique name.
Q. 89. What is De-normalization?
295 DATABASE MANAGEMENT SYSTEMS
Concurrent access and crash recoveyy A DBMS supports the notion of a transaction, which is
conceptually a single user's sequential program. Users can write transactions as if their
programs were running in isolation against the database. The DBMS executes the actions of
transactions in an interleaved fashion to optain good performance, but schedules them in such
a way as to ensure that conflicting operations are not permitted to proceed concurrently.
Further, the DBMS maintains a continuous log of the changes to the data, and if there is a
system crash, it can restore the database to a transaction-consistent state. That is, the actions of
in complete transactions are undone, so that the database state reflects only the actions of
completed transactions. Thus, if each complete transaction, executing alone, maintains the
consistency criteria, then the database state after recovery from a crash is consistent.
If these advantages are not important for the application at hand, using a collections of files may be
a better solution because of the increased cost and overhead of purchasing and maintaining a
DBMS.
Q. 93. Explain the difference logical and physical data independence.
Ans. Logical data independence means that users are shielded from changes in the logical structure
of the data, while physical data independence insulate users from changes in the physical strong of
the data.
Q. 94. What are the reponsibilities of a DBA? If we assume that the DBA is never interested in
running his or her own queries, does the DBA still need to understand query optimization?
Why'?
Ans. The DBA is responsible for :
• Designing the logical and physical schemas, as well as widely-used portions of the external
schema.
• Security and authorization
• Data availability and recovery from failures.
• Database tuning : The DBA is responsible for evolving the database, in particular the conceptual
and physical schemas, to ensure adequate performance as user requirements change.
A DBA needs to understand query optimization even if he/she is not interested in running his or her
own queries because some of these reponsibilities (database besign and tuning) are related to query
optimization. Unless the DBA understands the performance needs of widely used queries, and how
the DBMS will optimize and execute these queries, good design and tuning decisions cannot bc
made.
1. Define Database?
2. What is a DBMS?
3. What is the need for database systems?
4. Define tuple?
5. What are the reponsibilities of DBA?
6. Define schema?
7. Define entity and give example?
297 DATABASE MANAGEMENT SYSTEMS