You are on page 1of 5

Notes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding

Overview of SQL/PLSQL

SQL : Structured Query Language


PL/SQL : Procedural SQL


SQL : Declarative in Nature

i
at
ap

What to do

aj
How to do

Pr
ar

PL/SQL : Declarative in Nature

m

Ku
What to do
How to do

ul
At
by
Major Topics: ed
ut
1. Function
b
tri

2. Procedure
is

3. Trigger
D

4. Cursor
ly
ee
Fr

Difference : Function & Trigger


d

Syntax and Return Values


an

Function: Always returns a value = ticket value (Function)


ed

Procedure: May/May not return a value = (Name, seat) => ticket + Name +
at
ur

seat => Trigger - Mark the seat as not available


C
ly

SQL has:
al
on

Queries
rs
Pe

PL/SQL has:
PL/SQL Block/Code

SQL : Write a Query


PL/SQL : Write a Program/Procedure

Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.

Notes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding

Topics in PL/SQL

1. Group By (Optional)
2. Order By
3. WITH Aggregate (Min, Max)

i
at
ap
4. Operations

aj
5. Joins

Pr
6. Constraints (5 types)

ar
m
7. Indexes

Ku
8. Procedure

ul
At
9. Function ( 2 types: Single Row/Multi Row)

by
10. Package
11. Exceptions
ed
ut

12. Views
b
tri

13. Materialized Views


is
D

14. Cursor
ly
ee

15. Triggers
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe

Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.

Notes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding

SQL Commands Types:

1. Data Definition Language (DDL) - Structure of the Table


1. Create
2. Alter

i
at
3. Drop

ap
4. Truncate

aj
Pr
5. Rename

ar
m
2. Data Manipulation Language (DML) - Shuffling with Data

Ku
1. Select

ul
2. Insert

At
3. Update

by
4. Delete ed
ut
b

3. Data Control Language (DCL) - Permission who can access


tri

1. Grant
is
D

2. Revoke
ly
ee

4. Transaction Control Language (TCL) - Crucial Points in Transaction


Fr

1. Commit
d
an

2. Rollback
ed

3. Savepoint
at
ur
C
ly

Constraints:
al
on
rs

1. Primary Key - Roll No


Pe

2. Foreign Key -
3. Check
4. Unique -
5. Default - Admitted
6. Not Null - Name

Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.

Notes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding

PL/SQL Block

Declaration: (Optional)
a int

Executable Code: (Mandatory)

i
at
program code lines

ap
aj
Pr
Exception Handling: (Optional)

ar
Specific/Generic

m
Ku
End

ul
At
by
ed
ut
Example 1:
b
tri
is

BEGIN
D
ly

DBMS_OUTPUT.PUT_LINE(‘HELLO’); // Body (Executable Code)


ee

Section
Fr

END;
d
an
ed
at
ur

Example 2:
C
ly
al

DECLARE //
on

Declaration Section
rs
Pe

NAME VARCHAR2(10) := ’SID’;


BEGIN
DBMS_OUTPUT.PUT_LINE(NAME); // Body (Executable Code)
Section
END;

Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.

Notes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding

Example 3:

DECLARE //
Declaration Section
N1 NUMBER := 5;
N2 NUMBER := 0;

i
at
BEGIN

ap
DBMS_OUTPUT.PUT_LINE(N1/N2); // Body (Executable Code)

aj
Pr
Section

ar
EXCEPTION

m
WHEN ZERO_DIVIDE THEN. // Exception Section

Ku
DBMS_OUTPUT.PUT_LINE(‘Division by zero not allowed’);

ul
END;

At
by
ed
ut
b
tri
is
D
ly
ee
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe

Now you can find all lecture notes on: (PLSQL session 5 onwards & others)

Bookmark now -> atulkprajapati.medium.com (will update everything soon)

Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.

You might also like