Stucor CS3492-DJ
Stucor CS3492-DJ
Stucor CS3492-DJ
P
Procedures
Database Access Language
AP
Users
What is relational model.
The relational model represents the database as a collection of relations. A
C212.1 BTL 2
16. relation is nothing but a table of values. Every row in the table represents a
collection of related data values. These rows in the table denote a real-world
entity or relationship.
List some of the relational model concepts.
R
1. Attribute: Each column in a Table. Attributes are the properties which define
a relation. e.g., Student_Rollno, NAME,etc.
2. Tables – In the Relational model the, relations are saved in the table format. It
CO
is stored along with its entities. A table has two properties rows and columns.
Rows represent records and columns represent attributes.
3. Tuple – It is nothing but a single row of a table, which contains a single
record.
4. Relation Schema: A relation schema represents the name of the relation with
its attributes. C212.1 BTL 1
17.
U
5. Degree: The total number of attributes which in the relation is called the
degree of the relation.
6. Cardinality: Total number of rows present in the Table.
ST
7. Column: The column represents the set of values for a specific attribute.
8. Relation instance – Relation instance is a finite set of tuples in the RDBMS
system. Relation instances never have duplicate tuples.
9. Relation key - Every row has one, two or multiple attributes, which is called
relation key.
10. Attribute domain – Every attribute has some pre-defined value and scope
which is known as attribute domain
List some relational integrity constraints.
1. Domain Constraints C212.1 BTL1
18.
2. Key constraints
3. Referential integrity constraints
Define domain constraints.
C212.1 BTL2
19. Domain constraints can be violated if an attribute value is not appearing in the
corresponding domain or it is not of the appropriate data type.
10
Domain constraints specify that within each tuple, and the value of each attribute
must be unique. This is specified as data types which include standard data types
integers, real numbers, characters, Booleans, variable length strings, etc.
Example:
Create DOMAIN CustomerName
CHECK (value not NULL)
The example shown demonstrates creating a domain constraint such that
CustomerName is not NULL
P
Example:
In the given table, CustomerID is a key attribute of Customer Table. It is most
likely to have a single key for one customer, CustomerID =1 is only for the
AP
CustomerName =" Google". C212.1 BTL2
20.
CustomerID CustomerName Status
1 Google Active
2 Amazon Active
3
R Apple Inactive
Define referential integrity constraints.
CO
Referential integrity constraints is base on the concept of Foreign Keys. A foreign
key is an important attribute of a relation which should be referred to in other
relationships. Referential integrity constraint state happens where relation refers to
a key attribute of a different or same relation. However, that key element must
exist in the table.
Example:
U
C212.1 BTL3
ST
21.
11
Easy to use: The relational model is easy as tables consisting of rows and
columns is quite natural and simple to understand C212.1 BTL1
P
23.
Query capability: It makes possible for a high-level query language like
SQL to avoid complex database navigation.
AP
Data independence: The structure of a database can be changed without
having to change any application.
Procedural langauge
List the relational algebraic operations.
• Basic operators: select, project, union, set difference, Cartesian product C212.1 BTL1
26. •
ST
12
P
AP
C212.1 BTL1
28.
R
CO
• R S is expensive to compute:
ST
13
P
the integer datatype then a big integer datatype is used.
Define a primary key.
AP
A column in a table whose values uniquely identify the rows in C212.1 BTL1
32.
the table. A primary key value cannot be NULLto matching
columns in other tables\
What is a Foreign key?
C212.1 BTL1
33. A column in a table that does not uniquely identify rows in that
R
table, but is used as a link to matching columns in other tables.
What is Relationship?
A relationship is an association between two tables. For example
CO
C212.1 BTL1
34. the relationship between the table "hotel" and "customer" maps
the customers to the hotels they have used.
C212.1 BTL1
35. sublinear-time. Instead of having to go through all records one by
one to identify those which match its criteria the query uses the
ST
index to filter out those which don't and focus on those who do.
Define view.
A view is a virtual or logical table composed of the result set of a
pre-compiled query. Unlike ordinary tables in a relational
C212.1 BTL1
36. database, a view is not part of the physical schema: it is a
dynamic, virtual table computed or collated from data in the
database. Changing the data in a view alters the data stored in the
database
What is a Query
C212.1 BTL1
37. A query is a request to retrieve data from a database with the
SQL SELECT instruction or to manipulate data stored in tables.
14
Define SQL
Structured Query Language (SQL), pronounced "sequel", is a
language that provides an interface to relational database
C212.1 BTL1
38. systems. It was developed by IBM in the 1970s for use in System
R. SQL is a de facto standard, as well as an ISO and ANSI
standard.
P
e) Indices
What is Data Dictionary May2003, 2004, Nov 2006& Nov 2007.
AP
Data dictionary : which stores meta data about the structure of the C212.1 BTL1
40.
database, in particular schema of the database.
What is Data independence & what are the levels. APRIL MAY 2008, MAY
/JUNE 2012, Nov 2017
The ability to modify a schema definition in one level without affecting a
R
schema definition in the next higher level called data independence.
C212.1 BTL1
41.
Different levels .
CO
Physical level
Logical level
View level
Define instance and schemas. April/May 2012
- Database change over times as information is inserted and deleted.
C212.1 BTL1
U
What are the various data base languages in SQL? April/May 2018
C212.1 BTL1
45. Data Definition Language (DDL)
Commands that define a database, including creating, altering, and dropping
15
P
AP
List the data types in SQL.
R
CO
C212.1 BTL1
46.
U
ST
16
P
needs to change the values of Street, City, State and Zip in multiple
records.
AP
The third problem occurs when forget to change the values in any of the
records. The database would then have inconsistent data.
What is data definition language?
Data Definition Language:
C212.1 BTL1
51. A data definition language or data description language (DDL) is a syntax
for defining the data structures using imperative verbs, especially database
schemas.
R
What is the syntax for creating a table in SQL?
Syntax:
CREATE TABLE [table name] ( [column definitions] ) [table parameters]
CO
Example:
The command to create a table named employees with a few sample columns
would be:
CREATE TABLE employees ( C212.1 BTL2
52. id INTEGER PRIMARY KEY,
first_name VARCHAR(50) NULL,
U
);
P
manipulate data in a database. This manipulation involves inserting data into
database tables, retrieving existing data, deleting data from existing tables and
modifying existing data.
AP
List the DML commands in SQL.
SELECT: This command is used to retrieve rows from a table.
The select syntax:
SELECT [column name(s)] from [table name] where [conditions].
UPDATE: This command modifies data of one or more records.
The update command syntax:
UPDATE table name SET column name = value where [condition]. C212.1 BTL1
57.
R
INSERT: This command adds one or more records to a database table.
The insert command syntax:
INSERT INTO table name [column(s)] VALUES [value(s)].
CO
DELETE: This command removes one or more records from a table according to
specified conditions.
Delete command syntax:
DELETE FROM table name where [condition].
List the aggregation functions in SQL.
COUNT returns the number of rows in a specified column.
U
58. MAX returns the largest value in a specified column. C212.1 BTL1
Examples:
Property (PropertyNo, Street, City, postcode, Type, OwnerNo, Rooms, Rent)
Query:
How many properties cost more than 350 per month to rent?
18
P
Example:
List the staff who work in the branch at ‗163 Main St‘.
AP
SELECT sno, fname, lname, position FROM staff WHERE bno
= (SELECT bno FROM branch WHERE street = ‗163 Main
St‘);
How to modify a data in a table in SQL?
R
Modifying Data in the DB (UPDATE)
Syntax
UPDATE table_name
CO
view.
The SET clause specifies the names of one or more
ST
corresponding columns.
What is DCL? BTL1
The Data Control Language (DCL) component of the SQL language is used
to create privileges to allow users access to, and manipulation of, the database.
C212.1
61. There are two main commands:
GRANT to grant a privilege to a user
REVOKE to revoke (remove) a privilege from a user
19
P
Example: GRANT SELECT ON employee TO user1;
Description:
AP
This command grants a SELECT permission on employee table to user1.
WITH GRANT option should be used carefully because if the GRANT SELECT
privilege is permitted on employee table to user1 using the WITH GRANT option,
then user1 can GRANT SELECT privilege on employee table to another user, such
as user2 etc. Later, if you REVOKE the SELECT privilege on employee from
user1, still user2 will have SELECT privilege on employee table.
Write about REVOKE command in SQL.
SQL REVOKE Command:
R
The REVOKE command removes user access rights or privileges to the database
objects.
CO
The Syntax for the REVOKE command is:
REVOKE privilege_name ON object_name FROM {user_name
|PUBLIC |role_name}
C212.1 BTL1
63. Example:
REVOKE SELECT ON employee FROM user1;
Description:
U
SELECT from that table until everyone who granted the permission revokes it.
Define privileges in SQL.
Privileges:
Privileges defines the access rights provided to a user on a database object.
There are two types of privileges.
C212.1 BTL1
64. 1) System privileges - This allows the user to CREATE, ALTER, or DROP
database objects.
2) Object privileges - This allows the user to EXECUTE, SELECT, INSERT,
UPDATE, or DELETE data from database objects to which the privileges apply.
20
The above rules also apply for ALTER and DROP system privileges.
What is object privileges?
Object privileges - This allows the user to EXECUTE, SELECT, INSERT,
UPDATE, or DELETE data from database objects to which the privileges apply.
P
AP
C212.1 BTL1
66.
R
CO
Define roles in SQL.
Roles: Roles are a collection of privileges or access rights. When there are many
users in a database it becomes difficult to grant or revoke privileges to users. C212.1 BTL1
67. Therefore, if you define roles, you can grant or revoke privileges to users, thereby
automatically granting or revoking privileges. You can either create Roles or use
the system roles pre-defined by oracle.
List the system privileges granted to role.
U
ST
C212.1 BTL1
68.
It's easier to GRANT or REVOKE privileges to the users through a role rather
than assigning a privilege directly to every user. If a role is identified by a
password, then, when you GRANT or REVOKE privileges to the role, you
definitely have to identify it with the password.
What is the syntax for dropping a role in SQL?
The Syntax to drop a role from the database:
C212.1 BTL1
70. DROP ROLE role_name;
Example: To drop a role called developer, you can write:
DROP ROLE testing;
Define TCL.
TCL - Transactional Control Language. It is used to manage different transactions
occurring within a database.
Examples of TCL commands include: C212.1 BTL1
71. COMMIT to apply the transaction by saving the database changes.
P
ROLLBACK to undo all changes of a transaction.
SAVEPOINT to divide the transaction into smaller sections. It defines
AP
breakpoints for a transaction to allow partial rollbacks.
Define COMMIT in SQL.
SYNTAX:
COMMIT [WORK] [ COMMENT 'text' | FORCE 'text' [, integer] ]
Description:
WORK : is supported only for compliance with standard SQL. The statements
COMMIT and COMMIT WORK are equivalent.
R
COMMENT : specifies a comment to be associated with the current transaction.
The 'text' is a quoted literal of up to 50 characters that Oracle stores in the data
CO
C212.1 BTL1
72. dictionary view DBA_2PC_PENDING along with the transaction ID if the
transaction becomes in-doubt.
can also use the integer to specifically assign the transaction a system change
number (SCN). If you omit the integer, the transaction is committed using the
current SCN. COMMIT statements using the FORCE clause are not supported in
ST
PL/SQL.
Define ROLLBACK statement in SQL.
PURPOSE:
To undo work done in the current transaction. You can also use this command to
manually und the work done by an in-doubt distributed transaction.
SYNTAX:
ROLLBACK [WORK][ TO [SAVEPOINT] savepoint | FORCE 'text' ]
C212.1 BTL1
73. Description:
WORK : is optional and is provided for ANSI compatibility.
TO : rolls back the current transaction to the specified savepoint. If you omit
this clause, the ROLLBACK statement rolls back the entire transaction.
transaction is identified by the 'text' containing its local or global transaction ID.
To find the IDs of such transactions, query the data dictionary view
DBA_2PC_PENDING. ROLLBACK statements with the FORCE clause are not
supported in PL/SQ
P
Static SQL
The source form of a static SQL statement is embedded within an application
program written in a host language such as COBOL.
AP
The statement is prepared before the program is executed and the operational form
of the statement persists beyond the execution of the program.
Static SQL statements in a source program must be processed before the program
is compiled. This processing can be accomplished through the DB2 precompiler or
C212.1 BTL1
75. the SQL statement coprocessor.
R
The DB2 precompiler or the coprocessor checks the syntax of the SQL statements,
turns them into host language comments, and generates host language statements to
invoke DB2.
CO
Dynamic SQL:
Programs that contain embedded dynamic SQL statements must be
precompiled like those that contain static SQL, but unlike static
C212.1 BTL1
76. SQL, the dynamic statements are constructed and prepared at run
ST
time.
The source form of a dynamic statement is a character string that is passed to DB2
by the program using the static SQL statement PREPARE or EXECUTE
IMMEDIATE.
PART-B
23
List and describe the features and purpose of database? C212.1 BTL5
1.
List and explain the limitations of file processing system? C212.1 BTL5
2.
Compare database vs file processing system? C212.1 BTL2
3.
What is data model? Explain various data models with example? C212.1 BTL2
4.
Explain the database system architecture with neat diagram? April/May 2017, C212.1 BTL2
5. Nov/Dec 2017
List and describe the components of database management system with neat C212.1 BTL2
6. diagram.
Define relational algebra. Explain various relational algebraic operations with C212.1 BTL2
7.
P
example. Nov/Dec 2016, April/May 2017
List and explain the properties of a relations with example. C212.1 BTL2
8
AP
What are the various data types in SQL? Explain them with example? C212.1 BTL2
9.
List and explain various database languages with example? C212.1 BTL2
10
Explain DML with example? C212.1 BTL3
11
R
Explain DDL with example? C212.1 BTL3
12
Explain DCL with example? C212.1 BTL3
13
CO
UNIT II
Bloo
Q. m’s
Questions CO
No. Leve
l
24
P
and relationship among those objects. An entity is a thing or object in the
real world that is distinguishable from other objects.
Define Specialization and Aggregation. C212.2
AP
It is the process of designating sub groupings within an entity set.It is a top
down process.
4. Specialization which is represented by triangle. The lable ISA stands for “is BTL1
a and represent, for eg that customer is a person.
Aggregation is a special kind of association that specifies a whole/part
relationship between the aggregate (whole) and a component part.
R
What are three characteristics of a relational database system?Nov/Dec C212.2
2008
5.o Controlling redundancy BTL1
CO
o Restricting unauthorized access
o Providing multiple user interfaces
Give the distinction between primary key, candidate key and super key. C212.2
Nov/Dec
2006,2009
o Primary key – is used in a data base to avoid duplication of attributes and
U
o R={ A1,A2,…,An}. The constraint states that ,for any two tuples t1 and t2
in r such that t1[X]=t2[X] , we must also have t1[Y] = t2[Y].
We can also say that Y is functionally dependent on X.
25
P
What is an attribute? C212.2
Attributes:
AP
Attributes - Each entity is described by a set of
attributes/properties.studententity
10. Example: BTL2
StudName–name of the student.
RollNumber–the roll number of the student.
Sex–the gender of the student etc.
R
All entities in an Entity set/type have the same set of attributes.
What is derived attributes? C212.2
Derived attributes are those created by a formula or by a summary operation
CO
11. BTL2
on other attributes
12. BTL2
P
15. First, keys will typically be used as links, ie. key values will appear in other BTL2
relations to represent their associated tuples
Second, keys form the basis for constructing indexes to speed up retrieval
AP
of tuples from a relation. Small keys will decrease the size of indexes and
the time to look up an index.
Define a relational schema? C212.2
A Relational Database Schema comprises
1. the definition of all domains
16. BTL1
2. the definition of all relations, specifying for each
a)
R
its intension (all attribute names), and
b) a primary key
List the uses of functional dependencies? C212.2
CO
We use functional dependencies to:
test relations to see if they are legal under a given set of functional
dependencies.
17. If a relation r is legal under a set F of functional dependencies, we say BTL1
that r satisfies F.
U
27
P
Database normalization is the process of removing redundant data from
the tables in to improve storage efficiency, data integrity, and scalability.
AP
In the relational model, methods exist for quantifying how efficient a
20. database is. These classifications are called normal forms (or NF), and BTL1
there are algorithms for converting a given database between them.
Normalization generally involves splitting existing tables into multiple
ones, which must be re-joined or linked each time a query is issued.
R
Define data Anomalies. C212.2
Data Anomalies
Data anomalies are inconsistencies in the data stored in a database as a
21. BTL1
CO
result of an operation such as update, insertion, and/or deletion. Such
inconsistencies may arise when have a particular record stored in multiple
locations and not all of the copies are updated.
Define 1NF. C212.2
o Each table has a primary key: minimal set of attributes which can uniquely
identify a record
U
22. BTL1
o The values in each column of a table are atomic (No multi-value attributes
allowed). There are no repeating groups: two columns do not store similar
information in the same table
ST
P
• Dependency preservation: It is desirable that FDs are preserved when
26. BTL1
splitting relations up
AP
• Normalisation to 3NF is always lossless and dependency preserving
• Normalisation to BCNF is lossless, but may not preserve all dependencies
Define MVD. C212.2
A multivalued dependency is a full constraint between two sets of attributes
in a relation.
27. In contrast to the functional independency, the multivalued dependency BTL1
R
requires that certain tuples be present in a relation. Therefore, a multivalued
dependency is also referred as a tuple-generating dependency. The
multivalued dependency also plays a role in 4NF normalization.
CO
Define 4NF. C212.2
4th Normal Form
A Boyce Codd normal form relation is in fourth normal form if
there is no multi value dependency in the relation or
there are multi value dependency but the attributes, which are multi value
U
Ø Recall that a relation is in BCNF if all its determinant are candidate keys, in
other words each determinant can be used as a primary key.
Ø Because relation R has only one determinant (a, b, c), which is the
composite primary key and since the primary is a candidate key therefore R
is in BCNF.
Define 5NF
FIFTH NORMAL FORM
29. R is in 5NF if and only if every join dependency in R is implied by the C212.2 BTL1
candidate keys of R
5NF is always achievable.
29
P
AP
30. C212.2 BTL2
R
CO
P
What is candidate Keys?
AP
Candidate keys are those keys which is candidate for primary key of a table.
Such keys will full fill all the requirements of primary key which is not null
35. C212.2 BTL1
and have unique records is a candidate for primary key. So thus type of key
is known as candidate key. Every table must have at least one candidate key
but at the same time can have several.
Define the Primary Key.
36.
R
Unique attribute of a table will be considered as a primary key. Primary C212.2 BTL1
keys are used to identify tables. There is only one primary key per table.
What is Foreign Key? April/May 2018
CO
Foreign key are those keys which is used to define relationship between two
tables. When we want to implement relationship between two tables then we
use concept of foreign key. It is also known as referential integrity. We can
37. create more than one foreign key per table. foreign key is generally a C212.2 BTL1
primary key from one table that appears as a field in another where the first
table has a relationship to the second. In other words, if we had a table A
U
with a primary key X that linked to a table B where X was a field in B, then
X would be a foreign key in B.
Define alternate Key.
ST
If any table have more than one candidate key, then after choosing primary
key from those candidate key, rest of candidate keys are known as an
38. alternate key of that table. Suppose we have a table named Employee which C212.2 BTL1
has two columns EmpID and EmpMail, both have not null attributes and
unique value. If EmpID is considered as a primary key to that table then
EmpMail is known as alternate key.
Define Composite Key
When a key is created on more than one column then that key is known as
39. composite key. Consider a table "Student" which has two columns Sid and C212.2 BTL1
SrefNo and these two columns are used as a primary key for record
extraction, then this key is known as composite key.
31
40. C212.2
P
Primary key or Candidate keys can be either single column or combination
of multiple columns in a table.
What are the characteristics of primary key?
AP
Primary key is a special kind of index in that,
42. there can be only one; C212.2 BTL1
it cannot be nullable
it must be unique.
Define super key.
43. A super key is a set or one of more columns (attributes) to uniquely identify C212.2 BTL1
rows in a table.
R
What is need for normalization. Nov/Dec 2010
To ensure that the update anomalies do not occur.
CO
Normal forms provide a formal frame work for analyzing relation shemas
based on their keys and on the functional dependencies among their
44. attributes. C212.2 BTL1
A series of tests that can be carried out on individual relation schemas so
that the relation database can be normalized to any degree. When a test fails
U
, the relation violating that test must be decomposed into relations that
individually meet the normalization tests
Define lossless joins (or) What is non additive property. Nov/Dec 2011
ST
P
3. Evaluation
Explain trivial dependency? Nov/Dec 2009, 2010
51. Functional dependency of the form α ->β. is trivial if α C β. Trivial C212.2 BTL1
AP
functional dependencies are satisfied by all the relations.
Why must multivalued dependencies exist in pairs? Nov/DEC 2010,
2011
Multivalued dependencies: Multivalued dependencies are a result of 1NF
which disallowed an attribute in a tuple to have a set of values. If we have
two or more multivalued independent attributes in the same relation schema,
52. C212.2 BTL1
R
we get into the problem of having to repeat every value of one of the
attributes with every value of the other attributes with every value of the
other attribute to keep the relation instances consistent. A multivalued
CO
dependency X>Y specified on relation schema R where X and Y are
subsets of R specifies the following constraint on any relation r of R.
Comparison of BCNF and 3NF: Nov/Dec 2010, April/may2011
3NF design is always dependency preserving and lossless.
53. dependency preserving is difficult to achieve in BCNF sometimes. C212.2 BTL1
BCNF strictly removes transitive dependency.
U
33
PART-B
BLO
Q. OM’S
QUESTIONS CO
NO. LEVE
L
Explain The Different Types Of Normalization Nov/Dec 2009, 2010,
BTL5
1 2011, Nov/ Dec 2014, Apr/May 2015, Nov/Dec 2016 C212.2
Refer the Elmasri Navathe page no. 517
Explain In Detail About Boyce Codd Normal Form And Non Lossless
BTL5
2 Join Dependency. Nov/Dec 2009, 2010, 2011 C212.2
Refer the Elmasri Navathe page no. 529
P
Give Detail explanation about Data Model & its types. May/ June 2009,
Nov/ Dec 2014 BTL5
3 C212.2
Refer the Elmasri Navathe page no. 30
AP
Explain the various components of ER diagram with examples Briefly. BTL5
4 C212.2
Refer the Elmasri Navathe page no. 203
Draw ER Diagram for Difference applications ( Eg. Banking Systems .
Nov/ Dec 2014, Nov/Dec 2017, Restaurant menu ordering system Apr/
BTL5
5 May 2015, Car Rental company Nov/ Dec 2015), Car Insurance C212.2
R
Company (Nov/Dec 2016)
8
constraints with suitable example. Nov/Dec 2017
Distinguish between lossless-join decomposition and dependency C213.2 BTL5
9
preserving decomposition. Nov/Dec 2017.
C213.2 BTL1
10 Explain FNF, SNF, TNF and DCNF with an example. Nov/Dec 2016
Give detail Explanation about Query processing / Optimization
overview with example. Nov/Dec 2014, May/ June 2016, Nov/Dec 2016, C213.2 BTL1
11
Nov/Dec 2017.
Elmasri Navathe page no.679
C213.2 BTL5
12
34
A car rental company maintains a database for all vehicles in its current fleet. For all
vehicles, it includes the vehicle identification number, license number, manufacturer, model,
date of purchase, and color. Special data are included for certain types of vehicles.
• Trucks: cargo capacity.
• Sports cars: horsepower, renter age requirement.
• Vans: number of passengers.
• Off-road vehicles: ground clearance, drivetrain (four- or two-wheel drive).
Construct an ER model for the car rental company database. (Nov/Dec 15)
Construct an E-R diagram for a car insurance company whose customers own one or more
cars each. Each car has associated with it zero to any number of recorded accidents.
C213.2 EachBTL5
13
insurance policy covers one or more cars, and has one or more premium payments
P
associated with it. Each payment is for a particular period of time set of customers, and the
date when the payment was received. (Nov/Dec 16)
AP
For the ER diagram given below explain ER to Relational mapping
procedures
C213.2 BTL1
14
R
CO
Draw E – R Diagram for the “Restaurant Menu Ordering System”, which will facilitate the
food items ordering and services within a restaurant. The entire restaurant scenario is
detailed as follows. The Customer is able to view the food items menu, call the waiter, place
U
orders and obtain the final bill through the computer kept in their table. The waiters through
their wireless tablet PC are able to initialize a table for customers, control the table functions
C213.2 BTL1
15 to assist customers, orders, send orders to food preparation staff (chef) and finalize the
ST
customer’s bill. The food preparation staffs (Chefs), with their touch-display interface to the
system, are able to view orders sent to the kitchen by waiters. During preparation, they are
able to let the waiter know the status of each item, and can send notification when items are
completed. The system should have full accountability and logging facilities, and should
support supervisor actions to account for exceptional circumstances, such as a meal being
refunded or walked out on. (Apr/May 17)
35
UNIT III
TRANSACTIONS
Bloom’
Q. No. Questions CO
s Level
What is transaction?Nov/Dec 2010 Nov/Dec 2014
P
1 Collections of operations that form a single logical unit of work are C212.3 BTL1
called transactions.
AP
What are the properties of transaction? Nov /Dec 2009, April/May2010
NOV/DEC 2014 , May/June 2016 (or) What are the ACID properties?
APRIL/MAY-2011 , Nov/Dec 2017,
The properties of transactions are:
2 C212.3 BTL1
Atomicity
Consistency
Isolation
R
Durability
Define lock? Nov2009, Nov2010, Nov2011
CO
Lock is the most common used to implement the requirement is to allow a
3 C212.3 BTL1
transaction to access a data item only if it is currently holding a lock on that
item.
What are the different modes of lock? Nov2009, Nov2011
The modes of lock are:
4- Shared /Read C212.3 BTL1
U
- Exclusive /Write
5 Neither of the transaction can ever proceed with its normal execution. This C212.3 BTL1
situation is called deadlock.
Define the phases of two phase locking protocol April/May 2009
Growing phase: a transaction may obtain locks but not release any lock.
6 C212.3 BTL1
Shrinking phase: a transaction may release locks but may not obtain any
new locks.
What is meant by log-based recovery? April 2009
The most widely used structures for recording database
7 modifications is the log. C212.3 BTL1
The log is a sequence of log records, recording all the update activities in
the database. There are several types of log records.
8 Define shadow paging. Nov/Dec 2009 C212.3 BTL1
36
P
11 Deadlock
Starvation
What are the two statements regarding transaction?
AP
12 The two statements regarding transaction of the form: Begin transaction C212.3 BTL1
End transaction
What is recovery management component?
13 Ensuring durability is the responsibility of a software component of the base C212.3 BTL1
system called the recovery management component.
When is a transaction rolled back?
R
Any changes that the aborted transaction made to the database must be
14 C212.3 BTL3
undone. Once the changes caused by an aborted transaction have been
undone, then the transaction has been rolled back.
CO
P
22 An integral part of a database system is a recovery scheme that can restore C212.3 BTL1
the database to the consistent state that existed before the failure.
Define garbage collection. May/June 2016
AP
Garbage may be created also as a side effect of crashes. Periodically, it is
23 C212.3 BTL1
necessary to find all the garbage pages and to add them to the list of free
pages. This process is called garbage collection.
Differentiate strict two phase locking protocol and rigorous two phase
locking protocol. May/June 2016
In strict two phase locking protocol all exclusive mode locks taken by a
24 C212.3 BTL1
R
transaction is held until that transaction commits. Rigorous two phase
locking protocol requires that all locks be held until the transaction
commits.
CO
How the time stamps are implemented
Use the value of the system clock as the time stamp. That is a transaction‟s
time stamp is equal to the value of the clock when the transaction enters the
25 C212.3 BTL1
system. • Use a logical counter that is incremented after a new timestamp
has been assigned; that is the time stamp is equal to the value of the counter.
U
What are the time stamps associated with each data item?
W-timestamp (Q) denotes the largest time stamp if any transaction that
26 C212.3 BTL1
executed WRITE (Q) successfully. • R-timestamp (Q) denotes the largest
ST
P
List the four conditions for deadlock. Nov/Dec 2016
1. mutual exclusion: at least one process must be held in a non-
sharable mode.
AP
2. hold and wait: there must be a process holding one resource and
30 waiting for another. C212.3 BTL1
3. No preemption: resources cannot be preempted.
4. circular wait: there must exist a set of processes
[p1, p2, ..., pn] such that p1 is waiting for p2, p2 for p3, and
so on upto pn.
R
What is serializible schedule? April/May 2017
To process transactions concurrently, the database server must execute some
component statements of one transaction, then some from other
CO
31 C212.3 BTL1
transactions, before continuing to process further operations from the first.
The order in which the component operations of the various transactions are
interleaved is called the schedule
What type of locking needed for insert and delete operations? April/May
2017
Share/Exclusive (for Read/Write) Locks
U
We should allow several transactions to access the same item A if they all
32 C212.3 BTL1
access A' for reading purposes only. However, if a transaction is to write an
item A, it must have exclusive access to A. For this purpose, a different type
ST
i.e. the first user who acquires an exclusive lock will continue to have the
sole ownership of the resource, and no other user can acquire an exclusive
lock on that resource
What is query execution plan? April/May 2017
34 The Query Execution Plans describe the steps and the order used to access C212.3 BTL1
or modify data in the database.
What are the costs involved in query execution? April/May 2017
i. Access cost to secondary storage.
ii. Disk storage cost.
35 C212.3 BTL1
iii. Computation cost
iv. Memory usage cost and
v. Communication cost
P
Define atomicity?
36 Either all operations of the transaction are refl ected properly in the database C212.3 BTL1
or none are.
AP
Define Durability?
37 A transaction completes successfully then changes It has made to the C212.3 BTL1
database persist even if there are system failure.
What is transaction-management component?
Ensuring atomicity is the responsibility of the database system itself
38 C212.3 BTL1
specifically, it is handled by a component called the transaction-
R
management component.
What are the two operation for accessing data in transaction?
39 Read(x)- transfer data item x from database. C212.3 BTL1
CO
Write(x)- transfer data item x from the local buffer.
What do you mean by read only transaction?
40 The data base operation in a transaction do not update the database but only C212.3 BTL1
retrieve data, the transaction is called a read-only transaction.
What are the steps followed in Executing read(x)command in
U
transaction?
41 1. Find the address of the disk block that contains item x. C212.3 BTL1
2. Copy that disk block in to a buffer in main memory.
3. Copy item x from the buffer to the program variable named x.
ST
Define Schedule.
45 C212.3 BTL1
The chromosomal order in which instructions are executed in the system.
When the schedule is called serial?
Each serial schedule consists of a sequence of instruction from various
46 C212.3 BTL1
transaction where the instruction belonging to one single transaction appear
together in that schedule.
When two operation in schedule are said to be conflict?
i) Two operation belong to different transaction
47 C212.3 BTL1
ii) Two operation access the same item x
iii) At least one of the operation is write-item (x)
Define cascading rollback?
48 An uncommitted transaction has to be roll back because it read an item C212.3 BTL1
P
from a transaction that failure.
When the schedule is said to cascade less?
A schedule is said to be cascadeless or avoid cascading roll back if every
AP
49 C212.3 BTL1
transaction in the schedule reads only items that were written by committed
transactions.
Define lock table?
50 System maintain record for the items that are currently locked in lock table C212.3 BTL1
that which could be organized as a hash file.
What you mean by lock conversion?
51
R
A transaction that already holds a lock on item xis allowed under certain C212.3
condition to voncery the Locke from one locked state to another.
CO
PART-B
BLOO
M’S
Q. NO. QUESTIONS CO
U
LEVE
L
ST
P
Explain the concepts of concurrent execution in Transaction
BTL2
10 processing system. (Nov/Dec 2014) C212.3
Refer Elmasri Navathe page no.583
AP
Give detail explanation about ACID Properties Nov/Dec 2009,April
BTL4
11 2011 C212.3
Refer Elmasri Navathe page no.562
State and explain the lock based concurrency control with suitable BTL4
12 C212.3
examples? Nov/Dec 2017
Discuss the violations caused by each of the following: dirty read, non- BTL5
13
R
repeatable read and phantoms with suitable example. April/May 2017.
C212.3
Explain why timestamp-based concurrency control allows schedules
BTL1
14 that are not recoverable. Describe how it can be modified through C212.3
CO
buffering to disallow such schedules. April/May 2017.
How can you implement atomicity in transactions? Explain. BTL6
15 C212.3
UNIT IV
U
IMPLEMENTATION TECHNIQUES
RAID – File Organization – Organization of Records in Files – Indexing and Hashing –Ordered
Indices – B+ tree Index Files – B tree Index Files – Static Hashing – Dynamic Hashing – Query
ST
Processing Overview – Algorithms for SELECT and JOIN operations – Query optimization
using Heuristics and Cost Estimation
PART – A
Question Bloom’s
Q. No. CO Level
P
The time for repositioning the arm is called the seek time and it
increases with the distance that the arm is called the seek time.
AP
Define rotational latency time. C213.4 BTL1
5
The time spent waiting for the sector to be accessed to appear under
the head is called the rotational latency time.
P
time to repair.
AP
What are the ways in which the variable-length records arise in
database systems? C213.4 BTL1
14
Storage of multiple record types in a file, Record types that allow
variable lengths for one or more fields, Record types that allow
repeating fields.
C213.4 BTL1
CO
15
Anchor block: Contains the first record of a chain.
Overflow block: Contains the records other than those that are the
first record of a chain.
U
P
20
The number of buckets Dynamic hashing provides a
provided remains unchanged mechanism in which data buckets
AP
at all times i.e. fixed are added and removed dynamically
and on-demand .i.e. no. of buckets
not fixed.
Space and overhead is more Minimum space and less overhead
As file grows performance Performance do not degrade as file
decreases grows
R
List out the mechanisms to avoid collision during
hashing.(Nov/Dec 16)
In overflow chaining, the overflow buckets of a given bucket are
CO
C213.4 BTL1
21 chained together in a linked list.
Above scheme is called closed hashing. An alternative, called
open hashing, which does not use overflow buckets, is not suitable
for database applications.
U
Non-leaf nodes are larger. Thus, B-Trees typically have greater C213.4 BTL1
22
depth than corresponding B +-Tree
Insertion and deletion more complicated than in B +-Trees
Implementation is harder than B+-Trees.
State the need for Query Optimization. (Apr/May 15) C213.4 BTL1
26
The query optimizer attempts to determine the most efficient way to
execute a given query by considering the possible query plans.
What is meant by software and hardware RAID systems? May/June 2016
RAID can be implemented with no change at the hardware level, using only
C213.4 BTL1
27 software modification. Such RAID implementations are called software RAID
P
systems and the systems with special hardware support are called hardware RAID
systems.
What is the use of RAID? April/May2009, Nov/Dec2010
AP
A variety of disk-organization techniques, collectively called redundant
C213.4 BTL1
28 arrays of independent disks are used to improve the performance and reliability
46
faster than scanning the entire data file for the indexed data.
P
technique is called mirroring or shadowing. A logical disk then consists of two
physical disks, and write is carried out on both the disk. If one of the disks fails the C213.4 BTL1
34
AP
data can be read from the other. Data will be lost if the second disk fails before the
first fail ed disk is repaired.
– When writing data, corresponding parity bits must also be computed and written
to a parity bit disk
– To recover data in a damaged disk, compute XOR of bits from other disks
(including parity bit disk)
I/O operation addresses all the drives at the same time, RAID 3 cannot overlap
I/O. For this reason, RAID 3 is best for single-user systems with long record
applications
P
What are the Types of Ordered Indices
Dense index C213.4 BTL1
40
AP
Sparse index
Sequential scan using primary index is efficient, but a sequential scan using a
secondary index is expensive
– each record access may fetch a new block from disk
ST
Each algorithm may apply only to particular storage structures and access paths
(such index,…).
Only execution strategies that can be implemented by the RDBMS algorithms
and that apply to the particular query and particular database design can be
considered by the query optimization module.
P
Bucket address table may itself become very big.
What are the Cost functions for SELECT Operation
AP
Linear Search:
– [nBlocks(R)/2], if the record is found. BTL1
– [nBlocks(R)], if no record satisfied the condition. C213.4
46
Binary Search :
o [log2(nBlocks(R))], if equality condition is on key attribute, because SCA(R) = 1
in this case.
o[log2(nBlocks(R))] + [SCA(R)/bFactor(R)] – 1, otherwise.
R
Write the Cost functions for JOIN Operation
Join operation is the most time consuming operation to process.
An estimate for the size (number of tuples) of the file that results after the JOIN BTL1
CO
operation is required to develop reasonably accurate cost functions for JOIN C213.4
47 operations.
The JOIN operations define the relation containing tuples that satisfy a specific
predicate F from the Cartesian product of two relations R and S.
The main aim of query optimization is to choose the most efficient way of C213.4
48 implementing the relational algebra operations at the lowest possible cost.
ST
PART – B
49
BLOOM’S
Q. NO. QUESTIONS CO
LEVEL
C213.4 BTL5
1 Describe File Organization.
April/May2009, 2011
C213.4 BTL5
2 Define RAID and Briefly Explain RAID
techniques.(Nov/Dec 14, 15, 16) (Apr/May 15,16)
C213.4 BTL2
3
Explain Secondary storage devices.
C213.4 BTL5
4 Explain about static and dynamic hashing with an
P
example
C213.4 BTL3
5 Explain about Multidimensional and parallel with an
AP
example
C213.4 BTL5
6
Explain about ordered indices with an example
C213.4 BTL5
7 Explain about B+ trees indexing concepts with an
example (Nov/Dec 14)(May/June 16)
R
Explain about B trees indexing concepts with an C213.4 BTL5
8
example (Nov/Dec 14)
CO
50
Give detail Explanation about Hashing & Types of Hashing. Nov/Dec 2015
C213.4 BTL1
15
UNIT V
ADVANCED TOPICS
Distributed Databases: Architecture, Data Storage, Transaction Processing – Object-based Databases:
Object Database Concepts, Object-Relational features, ODMG Object Model, ODL, OQL – XML
P
Databases: XML Hierarchical Model, DTD, XML Schema, XQuery – Information Retrieval: IR
Concepts, Retrieval Models, Queries in IR systems.
AP
Bloo
Q. m’s
Questions CO
No. Leve
l
C213.5 BTL2
5
51
P
An object database is a database management system in which C213.5 BTL1
7
information is represented in the form of objects as used in object-
AP
oriented programming. Object-relational databases are a hybrid of
both approaches.
Define ODL.
ODL langauge is used to create object specifications:
C213.5 BTL1
classes and interfaces
11
- Using the specific langauge bindings to specify how ODL
constructs can be mapped to constructs in specific programming
language, such as C++, SMALLTALK, and JAVA
52
P
Can we have more than one constructor in a class? If yes, explain C213.5 BTL1
14
the need for such a situation. (Nov/Dec 15)
Yes, default constructor and constructor with parameter
AP
Define XML Database.
An XML database is a data persistence software system that allows C213.5 BTL4
15 data to be stored in XML format. These data can then be queried,
exported and serialized into the desired format. XML databases are
usually associated with document-oriented databases.
R
Define OQL with syntax.
Entry point to the database: needed for each query which can
be any named persistent object:
CO
class Person
( extent persons
key ssn) C213.5 BTL1
16
{ ... ... }
class Faculty extends Person ENTRY POINTS
U
( extent faculy )
{ ... ... }
class Department
( extent departmet key dname){ ... ... }
ST
Is XML Hierarchical?
XML documents have a hierarchical structure and can conceptually be
P
C213.5 BTL1
19 interpreted as a tree structure, called an XML tree. XML documents
must contain a root element (one that is the parent of all other
AP
elements). All elements in an XML document can contain sub
elements, text and attributes.
What is DTD?
A document type definition (DTD) contains a set of rules that can be
C213.5 BTL1
20 used to validate an XML file. After you have created a DTD, you can
edit it manually, adding declarations that define elements, attributes,
R
entities, and notations, and how they can be used for any XML files
that reference the DTD file.
CO
What is the use of XML Schema?
XML Schema is commonly known as XML Schema Definition C213.5 BTL4
21
(XSD). It is used to describe and validate the structure and the content
of XML data. XML schema defines the elements, attributes and data
types. Schema element supports Namespaces.
U
Wildcard Queries
Natural Language Queries
P
5. Click Next.
6. Optional: You can use a DTD template as the basis for your new
AP
DTD file. To do so, click the Use DTD Template check box, and
select the template you want to use.
7. Click Finish.
stops working for some time another system can complete the task. C213.5 BTL2
27 Availability: In distributed database system reliability can be achieved
even if sever fails down. Another system is available to serve the client
request. Performance: Performance can be achieved by distributing
ST
55
P
In these systems, each peer acts both as a client and a server for imparting database
services. The peers share their resource with other peers and co-ordinate their
activities.
C213.5 BTL2
AP
31 This architecture generally has four levels of schemas −
Global Conceptual Schema − Depicts the global logical view of data.
Local Conceptual Schema − Depicts logical data organization at each site.
Local Internal Schema − Depicts physical data organization at each site.
External Schema − Depicts user view of data
Write short notes on Multi - DBMS Architectures
This is an integrated database system formed by a collection of two or more
R
autonomous database systems.
Multi-DBMS can be expressed through six levels of schemas −
Multi-database View Level − Depicts multiple user views comprising of subsets
CO
of the integrated distributed database.
Multi-database Conceptual Level − Depicts integrated multi-database that
comprises of global logical multi-database structure definitions.
Multi-database Internal Level − Depicts the data distribution across different C213.5 BTL1
32
sites and multi-database to local data mapping.
Local database View Level − Depicts public view of local data.
U
Local database Conceptual Level − Depicts local data organization at each site.
Local database Internal Level − Depicts physical data organization at each site.
There are two design alternatives for multi-DBMS −
Model with multi-database conceptual level.
ST
result in only the reading of the relation, then several sites can process queries
involving r in parallel. The more replicas of r there are, the greater the chance that
the needed data will be found in the site where the transaction is executing. Hence,
data replication minimizes movement of data between sites. Increased overhead
on update. The system must ensure that all replicas of a relation r are consistent;
otherwise, erroneous computations may result. Thus, whenever is updated, the
update must be propagated to all sites containing replicas. The result is increased
overhead. For example, in a banking system, where account information is
replicated in various sites, it is necessary to ensure that the balance in a particular
account agrees in all sites.
Define Transparency
The user of a distributed database system should not be required to know where the C213.5 BTL1
35 data are physically located nor how the data can be accessed at the specific local
site. This characteristic, called data transparency, can take several forms:
P
What are the DISTRIBUTED TRANSACTIONS
There are two types of transaction that we need to consider.
AP
Local transactions are those that access and update data in only one local
database; C213.5 BTL1
36
Global transactions are those that access and update data in several local
databases
directly. For instance, we can define the following structured type to represent a
composite attribute name with component attribute firstname and lastname:
Write the Object-Identity and Reference Types in SQL
ST
P
There are three types of literals: atomic, structured, and collection. C213.5 BTL1
44
AP
What are the notation of ODMG??
The notation of ODMG uses three concepts: interface, literal, and clas C213.5 BTL1
45
58
PART – B
BLOOM’S
Q. NO. QUESTIONS CO
LEVEL
C213.5 BTL5
2 Explain in detail (i) Information Retrieval (iii) Transaction processing
(Nov/Dec 14)
C213.5 BTL6
P
3
Write short notes on Distributed Transactions. (Nov/Dec 14)
C213.5 BTL5
4
AP
Explain in detail the Client - Server Architecture for DDBMS
(Nov/Dec 16)
C213.5 BTL5
10
Explain ODL and OQL with an example.
C213.5 BTL5
11
Explain ODMG – Object Model in detail
Explain XML Databases. C213.5 BTL5
12
Exaplain the object relational database features. C213.5 BTL5
13
Explain Information Retrieval process in detail C213.5 BTL5
14
Give the DTD or XML Schema for an XML representation of the nested relational
schema . Nov/ Dec 2016 C213.5 BTL5
15
P
AP
R
CO
U
ST
60