Sie sind auf Seite 1von 12

VALLIAMMAI ENGINEERING COLLEGE

SRM Nagar,Kattankulathur- 603 203

DEPARTMENT OF INFORMATION TECHNOLOGY

Academic Year 2016-2017

QUESTION BANK-ODD SEMESTER

UNIT 1

PART A

1. Write the characteristics that distinguish the Database approach with the File based
approach?
There are a number of characteristics that distinguish the database approach with the file-
based approach.
Self-Describing Nature of a Database System
Sharing of data and Multiuser system
Enforcing Integrity Constraints
Restricting Unauthorized Access
Data Independence
Transaction Processing
Providing multiple views of data
Control Data Redundancy
2. Point out the disadvantages of file processing system.

The disadvantages of file processing systems are


Data redundancy and inconsistency
Difficulty in accessing data
Data isolation
Integrity problems
Atomicity problems
Concurrent access anomalies
3. List out the components of DBMS.
DBMS components broadly divided into storage managert and query processor
components.Stroage manager component includes
Authorization and integrity manager
Transaction manager
File manager
Buffer manager

Query processor component includes


DDL Interpreter
DML Compiler
Query evaluation engine
4. Discuss the purpose of Database Management System?

The disadvantages of file processing systems are


Data redundancy and inconsistency
Difficulty in accessing data
Data isolation
Integrity problems
Atomicity problems
Concurrent access anomalies

Database systems offer solutions to all the above problems.

5. Is it possible for several attributes to have the same domain? Illustrate your answer with
suitable examples.
Domain is a set of possible values for an attribute.
Yes,It is possible for several attributes to have the same domain.
Example :

Cname Cstreet Ccity


Kumar North Street Madurai
Rajesh South street Trichy
Ramesh West cross street Madurai

6. What are the three levels of data abstraction?

Physical level
Logical level
View leve
7. List out the Codd's Rule.
Rule 0: The Foundation rule: This rule states that for a system to qualify as an RDBMS,
it must be able to manage database entirely through the relational capabilities.

Rule 1 : Information rule


All information(including metadata) is to be represented as stored data in cells of tables.
The rows and columns have to be strictly unordered.

Rule 2 : Guaranted Access


Each unique piece of data(atomic value) should be accesible by : Table Name +
primary key(Row) + Attribute(column).
NOTE : Ability to directly access via POINTER is a violation of this rule.
Rule 3 : Systemetic treatment of NULL
Null has several meanings, it can mean missing data, not applicable or no value. It should
be handled consistently. Primary key must not be null. Expression on NULL must give
null.

Rule 4 : Active Online Catalog


Database dictionary(catalog) must have description of Database. Catalog to be governed
by same rule as rest of the database. The same query language to be used on catalog as on
application database.

Rule 5 : Powerful language


One well defined language must be there to provide all manners of access to data.
Example: SQL. If a file supporting table can be accessed by any manner except SQL
interface, then its a violation to this rule.

Rule 6 : View Updation rule


All view that are theoretically updatable should be updatable by the system.

Rule 7 : Relational Level Operation

There must be Insert, Delete, Update operations at each level of relations. Set operation like
Union, Intersection and minus should also be supported.

Rule 8 : Physical Data Independence


The physical storage of data should not matter to the system. If say, some file supporting
table were renamed or moved from one disk to another, it should not effect the
application.

Rule 9 : Logical Data Independence


If there is change in the logical structure(table structures) of the database the user view of
data should not change. Say, if a table is split into two tables, a new view should give
result as the join of the two tables. This rule is most difficult to satisfy

Rule 10 : Integrity Independence

The database should be able to conforce its own integrity rather than using other programs. Key
and Check constraints, trigger etc should be stored in Data Dictionary. This also
make RDBMS independent of front-end.
Rule 11 : Distribution Independence
A database should work properly regardless of its distribution across a network. This lays
foundation of distributed database.

Rule 12 : Nonsubversion rule


If low level access is allowed to a system it should not be able to subvert or bypass
integrity rule to change data. This can be achieved by some sort of looking or encryption.

8. Create your own example for one to one and one to many relationship.
Relationship between a person and a drivers license is an example for an to one
relationship.

A car and its parts is an example for one to many relationship. Each part belongs to one
car and one car has multiple parts.

9. Express an entity relationship model with one example.

10. Analyze about single valued and multi valued attributes.


Attributes that can have single value at a particular instance of time are called
singlevalued. A person cant have more than one age value. Therefore, age of a person is
a single-values attribute. A multi-valued attribute can have more than one value at one
time. For example, degree of a person is a multi-valued attribute since a person can have
more than one degree.
11. Assess the significance of cardinality ratio.

In database design, the cardinality or fundamental principle of one data table with
respect to another is a critical aspect. The relationship of one to the other must be precise
and exact between each other in order to explain how each table links together.
In the relational model, tables can be related as any of "one-to-many" or "many-to-
many". This is said to be the cardinality of a given table in relation to another.
12. Explain about weak entity set with suitable example.
Payment entity set in Bank database management system is an example for weak entity
set. Though the payment number is generated separately for each loan several loan may
share the same payment number. We cant take payment number as primary key hence
payment entity set is an example for weak entity set.
13. Define Functional dependency.
Functional dependency is a constraint between two sets of attributes in a relation from
a database.Funtional dependency describes the relationship between attributes in a
relation.For example A B if A and B are attributes of relation R,and B is functionally
dependent on A ,if each value of A is associated with exactly one value of B.
14. Classify different types of Anomalies in relational databases.
Insertion anomalies(We are not able to insert valid value)
Deletion anomalies(We are not able to perform delete without losing a valid
information).
Modification anomalies(We have to update multiple rows).
15. Describe about lossless decomposition.
Property of decomposition which ensures that no spurious tuples are generated when
relations are reunited through a natural join operation is known as loss less
decomposition.

The decomposition is a lossless-join decomposition of R if at least one of the following


functional dependencies are in :
R1 R2 R1
R1 R2 R2
16. Demonstrate the need for Normalization.
To remove potential redundancy in design.Because redundancy causes several
anomalies such as insertion,deletion and update.
It uses the concept of functional dependencies and decomposition idea is used.
17. State the anomalies of 1NF.
repetition of data
to change a department name all tuples of the relation need to be updated since
the department name can exist in multiple rows.
18. Show how 4NF in Normal form is more desirable than BCNF?
To be in Fourth Normal Form,
a relation must first be in Boyce-Codd Normal Form.
a given relation may not contain more than one multi-valued attribute.
4NF is more desirable than BCNF because it reduces the repetition of information.
19. Design a Database to illustrate BCNF.
A relational schema R is considered to be in BoyceCodd normal form (BCNF) if and
if the relation is in 3NF and for every one of its dependencies X Y, one of the
following conditions holds true

X Y is a trivial functional dependency (i.e., Y is a subset of X)

X is a superkey for schema R


Author Nationality Book title Genre Number of pages

William Shakespeare English The Comedy of Errors Comedy 100

Markus Winand Austrian SQL Performance Explained Textbook 200

Jeffrey Ullman American A First Course in Database Systems Textbook 500

Jennifer Widom American A First Course in Database Systems Textbook 500

The nontrivial functional dependencies in the table are:

author nationality

book title genre, number of pages

We can easily see that the only key is the set {author, book title}.

The same data can be stored in a BCNF schema. However, this time we would need three tables.

Author Nationality

William Shakespeare English

Markus Winand Austrian

Jeffrey Ullman American

Jennifer Widom American

Book title Genre Number of pages


Book title Genre Number of pages

The Comedy of Errors Comedy 100

SQL Performance Explained Textbook 200

A First Course in Database Systems Textbook 500

A First Course in Database Systems Textbook 500

Author Book title


William Shakespeare The Comedy of Errors
Markus Winand SQL Performance Explained
Jeffrey Ullman A First Course in Database Systems
Jennifer Widom A First Course in Database Systems
The functional dependencies for this schema are the same as before:

author nationality

book title genre, number of pages

The key of the first table is {author}. The key of the second table is {book title}. The key of the
third table is {author, book title}. There are no functional dependencies violating the BCNF
rules, so the schema is in Boyce-Codd normal form.

20. Summarize the steps needed to perform denormalization.


Denormalization aids the process of systematically adding redundancy to the database to
improve performance after other possibilities, such as indexing, have failed.
Always create a conceptual data model that is completely normalized.
Consider denormalization as the last option to boost performance.
Never presume denormalization will be required.
To meet performance objectives, denormalization should be done during the database
design.
UNIT II

PART A

1. Differentiate between Dynamic SQL and Static SQL.

S.No. Static (embedded) SQL Dynamic (interactive) SQL

1. In static SQL how database will be accessed In dynamic SQL, how database will be

is predetermined in the embedded SQL accessed is determined at run time.

statement.

2. It is more swift and efficient. It is less swift and efficient.

3. SQL statements are compiled at compile SQL statements are compiled at run time.

time.

4. Parsing, validation, optimization, and Parsing, validation, optimization, and

generation of application plan are done at generation of application plan are done at

compile time. run time.

5. It is generally used for situations where data It is generally used for situations where
is distributed uniformly. data is distributed non-uniformly.

6. EXECUTE IMMEDIATE, EXECUTE and EXECUTE IMMEDIATE, EXECUTE

PREPARE statements are not used. and PREPARE statements are used.

7. It is less flexible. It is more flexible.

2. Why does SQL allow duplication tuples in a table or in a query result?


Duplicate rows are a fundamental part of the SQL model of data because the SQL
language doesn't really try to implement the relational algebra. SQL uses a bag
(multiset)-based algebra instead. The results of queries and other operations in relational
algebra are relations that always have distinct tuples, but SQL DBMSs don't have the
luxury of dealing only with relations. Given this fundamental "feature" of the SQL
language, SQL database engines need to have mechanisms for processing and storing
duplicate rows.
3. Define a super key.
It is a set of one or more attributes taken collectively allow us to uniquely identify an
entity in the entity set .For example combination of customer_id and customer_name is
the super key for the customer entity set.
4. What are primary key constraints?
It is a candidate key that is chosen by the designer as the principal means of identifying
entities within an entity set. For example RegNo is a primary key of student entity set.
5. Name the categories of SQL commands.

Data Definition Language (DDL) Statements


Data Manipulation Language (DML) Statements
Transaction Control Statements
Session Control Statements
System Control Statement
Embedded SQL Statements

6. Show the need for referential integrity key constraints.


A foreign key (FK) is a column or combination of columns that is used to establish and
enforce a link between the data in two tables. You can create a foreign key by defining a
FOREIGN KEY constraint when you create or modify a table.

Although the main purpose of a FOREIGN KEY constraint is to control the data that can
be stored in the foreign key table, it also controls changes to data in the primary key
table.

7. Discuss the use of creating view?

A VIEW is actually a query and the output of the query becomes the content of the view.
The VIEW can be treated as a base table and it can be QUERIED, UPDATED,
INSERTED INTO, DELETED FROM and JOINED with other tables and views.
A VIEW is a data object which does not contain any data. It's contents are the resultant of
a base table. They are operated just like base table but they doesnt contain any data of
their own.
A view can be accessed with the use of SQL SELECT statement like a table. A view can
also be made up by selecting data from more than one table.
8. Give the syntax to create the table.

CREATE TABLE table_name(


column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);

9. Perform the following with syntax and with a suitable example.

i. Create a table from existing table.

ii. Insert data in your table from another table.

i. Create table stud as select * from student;


ii. Insert into stud values(1245,ramesh,hosur,9950672198);
10. Write a query to retrieve the names of all instructors along with their department names
and department building name.
Instructor(ID,name,dept_name,salary)
Department(dept_name,building,budget)
Select name,dept_name,building from instructor,department where
instructor.dept_no=building.dept_no;
11. Analyze about DCL command.

A data control language (DCL) is a syntax similar to a computer programming


language used to control access to data stored in a database (Authorization). In particular, it
is a component of Structured Query Language (SQL).
Examples of DCL commands include:

GRANT to allow specified users to perform specified tasks.


REVOKE to cancel previously granted or denied permissions.

12. Give the syntax for display the data based on condition
Select [ Distinct / Unique ] ( *columnname [ As alias}, .]
From tablename
[ where condition ]
[ Group BY group _by_expression ]
[Having group_condition ]
[ORDER BY {col(s)|expr|numeric_pos} [ASC|DESC] [NULLS FIRST|LAST]];

13. Apply the significance of TCL commands with suitable example?


Transaction Control Language(TCL) commands are used to manage transactions in
database.These are used to manage the changes made by DML statements.
Commit command is used to permanently save any transaaction into database.
Roll Back command restores the database to last commited state.
Save Point used to divide the transaction into smaller sections. It defines
breakpoints for a transaction to allow partial rollbacks.
14. What are aggregate functions? And list the aggregate functions supported by SQL?
Aggregate functions are used to compute against a "returned column of numeric data"
from your SELECT statement. They basically summarize the results of a particular
column of selected data.

MIN returns the smallest value in a given column


MAX returns the largest value in a given column
SUM returns the sum of the numeric values in a given column
AVG returns the average value of a given column
COUNT returns the total number of values in a given column
COUNT(*) returns the number of rows in a table

Das könnte Ihnen auch gefallen