Professional Documents
Culture Documents
Nitin Tyagi
Nitin Tyagi
DBMS
RDBMS
DBMS Based Storage Approach
OS File System Storage Based Approach
Relational Model
SQL (Structured Query Language)
Tables
Data Types
Simple Queries
Select Query
Selecting Columns
Selection of Tuples
Relational operators in sql
Logical operators in sql
Create table command
Constraints
Inserting values into table
String Operations
Aggregate Functions
Update statement
Delete tuples from table
Deleting a Table
Alter table command
Commit and Rollback
Complex Queries
Joining Relations
Subqueries
Operations on Result Sets
union
intersect
minus
Group by clause
Views
Sequence & Synonym
Introduction of PL/SQL
Introduction PL/SQL
(Procedural Language/SQL) is a procedural extention of oracle-SQL that
offers language constructs similar to those in imperative programming
language. PL/SQL allows its users to develop complex database applications
that require the usage of control structure & procedural elements such as
procedures, function, modules etc.
PL/SQL Block:
Named blocks: Named blocks are the block having headers or labels,
Named blocks can either be sub programs (procedures, function, packages)
or triggers (specialized block that initiate some action before or after some
data is manipulated in a table).
Variable:
greater than one, an exception is raised. To process the queries that might
generate zero or multiple rows a cursor can be used.
Coments:- Coments are statements that are ignored by the compiler & are
used to enhance program readability. PL/SQL supports two ways of adding
comments: Single line comments:- These comments start with sign_ _
Multiline Comments:- These comments start with/ * & end with * /
SELECTION STATEMENT:
IF <condition> Then
Statement block
END IF;
IF <condition> Then
Statement block 1
ELSE
Statement block 2
END IF;
END IF;
This form of the If statement is used to choose one out of
variable mutually exclusive choices. Here, the block, which is
associated with the condition that evaluates to true, is executed.
If none of the conditions is true, then the block associated with
the ELSE part is executed.
LOOPING STRUCTURE:a) Simple Loop:- LOOP. . .END LOOP. This construct creates an
infinite loop by default. In order to terminate this loop, we can
use the EXIT statement.
eg:- . . .
I:=1;
LOOP
Sum:= Sum + I;
I:= I + 1;
EXIT WHEN I > 10;
END LOOP;
...
b) Numeric FOR LOOP:- This looping construct is used to
repeat a set of instruction for a fixed number of times.
Eg: FOR I IN 1. . .10
LOOP
Sum:= Sum + 1
END LOOP;
c) WHILE LOOP:- This looping construct is used to repeat a set
of statement till a condition holds good.
Eg:
...
I : = 1;
WHILE (I<=10)
LOOP
Sum:= Sum + I;
I : = I + 1;
END LOOP;
...
GOTO Statement:
GOTO statement is used to jump ie., branch unconditionally to a
named label. Programs that use the GOTO statement are unstructured and
difficult to maintain so this statement should rarely be used. The syntax of
statement is:
GOTO label_name;