Professional Documents
Culture Documents
Database
Management
System
2
University Institute of Engineering (UIE)
Department of Computer
Department Science
of Computer and Engineering
Science (CSE)(CSE)
and Engineering
Contents of the Syllabus
UNIT-I [10h]
Overview of Databases: Database concepts, DBMS, Data Base System Architecture (Three
Level ANSI-SPARC Architecture), Advantages and Disadvantages of DBMS, Data Independence,
DBA and Responsibilities of DBA, Relational Data Structure, Keys, Relations, Attributes, Schema and
Instances, Referential integrity, Entity integrity.
Data Models: Relational Model, Network Model, Hierarchical Model, ER Model: Design,
issues, Mapping constraints, ER diagram, Comparison of Models.
Relational Algebra & Relational Calculus: Introduction, Syntax, Semantics, Additional
operators, Grouping and Ungrouping, Relational comparisons, Tuple Calculus, Domain Calculus,
Calculus Vs Algebra, Computational capabilities.
UNIT-II [10h]
Functional dependencies and Normalization: Functional dependencies, Decomposition, Full
Functional Dependency (FFD), Transitive Dependency (TD), Join Dependency (JD), Multi-valued
Dependency (MVD), Normal Forms (1NF, 2NF, 3NF, BCNF), De-normalization.
Database Security: Introduction, Threats, Counter Measures.
Control Structures: Introduction to conditional control, Iterative control and sequential control
statements, Cursors, Views.
3
University Institute of Engineering (UIE)
Department of Computer
Department Science
of Computer and Engineering
Science (CSE)(CSE)
and Engineering
Contents of the Syllabus
UNIT-III [10h]
Package, Procedures and Triggers: Parts of procedures, Parameter modes, Advantages of
procedures, Syntax for creating triggers, Types of triggers, package specification and package body,
developing a package, Bodiless package, Advantages of packages.
Transaction Management and Concurrency Control: Introduction to Transaction Processing,
Properties of Transactions, Serializability and Recoverability, Need for Concurrency Control, Locking
Techniques, Time Stamping Methods, Optimistic Techniques and Granularity of Data items.
Database Recovery of database: Introduction, Need for Recovery, Types of errors, Recovery
Techniques.
4
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
Chapter 2.3
(Control Structures)
Control Structures: Introduction to conditional control, Iterative control and
sequential control statements, Cursors, Views.
Why PL/SQL
• Procedural Language – SQL
• Acts as host language for stored procedures and triggers.
• Provides the ability to add middle tier business logic to client/server
applications.
• Provides Portability of code from one environment to another
• Improves performance of multi-query transactions.
• Provides error handling
Structure of PL/SQL
Exception Section
Structure of PL/SQL
Features of PL/SQL
Advantages of PL/SQL
• SQL is the standard database language and PL/SQL is
strongly integrated with SQL. PL/SQL supports both
static and dynamic SQL. Static SQL supports DML
operations and transaction control from PL/SQL block.
In Dynamic SQL, SQL allows embedding DDL
statements in PL/SQL blocks.
• PL/SQL allows sending an entire block of statements to
the database at one time. This reduces network traffic
and provides high performance for the applications.
• PL/SQL gives high productivity to programmers as it
can query, transform, and update data in a database.
PL/SQL
PL/SQL: if...then...else statement
• Iterative Control :
• Iterative control indicates the ability to repeat or skip
sections of a code block.
A loop marks a sequence of statements that has to be
repeated. The keyword loop has to be placed before the first
statement in the sequence of statements to be repeated, while
the keyword end loop is placed immediately after the last
statement in the sequence.
PL/SQL Cursor
• When an SQL statement is processed, Oracle creates a
memory area known as context area. A cursor is a pointer to
this context area. It contains all information needed for
processing the statement. In PL/SQL, the context area is
controlled by Cursor. A cursor contains information on a
select statement and the rows of data accessed by it.
• A cursor is used to referred to a program to fetch and process
the rows returned by the SQL statement, one at a time. There
are two types of cursors:
• Implicit Cursors
• Explicit Cursors
Views
• A view is the result set of a stored query on the data, which
the database users can query just as they would in a persistent
database collection object.
• This pre-established query command is kept in the database
dictionary.
• Unlike ordinary base tables in a relational database, a view
does not form part of the physical schema: as a result set, it is a
virtual table computed or collated dynamically from data in the
database when access to that view is requested.
• Changes applied to the data in a relevant underlying table are
reflected in the data shown in subsequent invocations of the
view.
Modifying views
• Does it even make sense, since views are virtual?
• It does make sense if we want users to really see views as
tables
• Goal: modify the base tables such that the modification
would appear to have been accomplished on the view
A simple case
CREATE VIEW UserPop AS SELECT uid, pop FROM User;
DELETE FROM UserPop WHERE uid = 123;
translates to:
DELETE FROM User WHERE uid = 123;
An impossible case
CREATE VIEW PopularUser AS SELECT uid, pop FROM
User WHERE pop >= 0.8;
INSERT INTO PopularUser VALUES(987, 0.3);
• No matter what we do on User, the inserted row will not
be in PopularUser
Example
• A view is equivalent to its source query. When queries are
run against views, the query is modified. For example, if
there exists a view named accounts_view with the content as
follows:
• accounts_view:
SELECT name,
money_received, money_sent, (money_received - money_sent)
AS balance, address, ... FROM table_customers c JOIN
accounts_table a ON a.customer_id = c.customer_id
Example(2)
• The application could run a simple query such as:
• Simple query
• SELECT name, balanceFROM accounts_view
• The RDBMS then takes the simple query, replaces the
equivalent view, then sends the following to the query
optimizer