SlideShare a Scribd company logo
Introduction to Database
www.collaborationtech.co.in
Bengaluru INDIA
Presentation By
Ramananda M.S Rao
Content
Content
Overview
Database Concepts
Database Fundamentals
Introduction to Database Management Systems
Different Models
Three Layer Architecture
Data Independence,
DDL, DML, DCL, Functions of DBA, DBM
Introduction to ORACLE technology stack
SQL Language
Introduction & Using SQL*Plus
SQL History and Standards, SQL Basics
SQL Data Types
Writing Basic SQL statements
Creating and Managing Tables
Insert, Update, Delete commands
Alter, Drop commands
Select Command
Constraints
www.collaborationtech.co.in
Content
SQL Operators and Functions
Single row functions
Aggregating data using group functions
Group By clause
Set Operators
Joins
Creating Views
Subquery
Nested Queries
Co-related Sub-queries
Controlling user access
Grant and Revoke Statements
Optimization and Performance
SQL Tuning
www.collaborationtech.co.in
Content
ER Model
Assignments on E-R Model
E-R to Relational Mapping
Assignments on E-R to Relational Mapping
Normalization
Assignments on Normalization
Using simple modeling Tool
Building model for Simple Applications
Simple Fund Management example
Simple Inventory example
Simple Security example
PL/SQL Programming
PL/SQL Variables and Constants
Using %TYPE and %ROWTYPE Attributes
PL/SQL Variable Scope
Creating Anonymous PL/SQL Block
Using DBMS_OUTPUT.PUT_LINE
PL/SQL Control Structures and Variables
Writing Interactive PL/SQL program
Embedding SELECT Statement inside PL/SQL Block,
Embedding DML Statements inside PL/SQL Block
www.collaborationtech.co.in
Content
Cursors and Exceptions
Cursors - Definition Cursor
Using Implicit and Explicit Cursors
Cursor Attributes, Cursor FOR loops, Parameterized Cursors
FOR UPDATE and WHERE CURRENT OF with Explicit Cursors
Exception Definition
Handling user defined,
Oracle predefined and non-predefined exceptions.
Propagating exceptions
Procedures , functions and Triggers
Creating Stored Procedures and functions
Invoking stored procedures
Parameter Modes – IN, OUT and IN OUT
Calling Stored Functions
Packages
Definition Packages
Advantages of using Packages
Components of a Package
Creating and using Package
www.collaborationtech.co.in
Content
Triggers - Definition Triggers
Database Triggers
Difference between Stored Procedure and Database Triggers
Trigger Components and types
Creating and using Database Triggers
Objects In database
Objects Types and Using Object Table
Creating and Using Collection Types
Dynamic SQL
Native Dynamic SQL
Using Packages like DBMS_OUTPUT, DBMS_PIPE, UTL_FILE,
DBMS_SQL
Bulk statements in PL/SQL
Creating Indexes
www.collaborationtech.co.in
Overview
 SQL stands for Structured Query Language.
 SQL is used to communicate with a database.
 SQL statements are used to perform tasks such as update
data on a database, or retrieve data from a database.
 SQL commands are divided into several different types,
among them data manipulation language (DML) and data
definition language (DDL) statements, transaction
controls and security measures.
 The DML vocabulary is used to retrieve and manipulate
data.
 DDL statements are for defining and modifying database
structures.
www.collaborationtech.co.in
Overview
 PL/SQL is an Oracle procedural extension for SQL. They
have designed this language for easy use of complex SQL
statements.
 PL SQL basically stands for "Procedural Language
extensions to SQL".
 It combines the data manipulation power of SQL with the
processing power of procedural language to create a
super powerful SQL queries.
 Similar to other database languages, it gives more control
to the programmers by the use of loops, conditions and
object oriented concepts.
www.collaborationtech.co.in
SQL
SQL> create database student
SQL>show database
SQL>create table employee
(id int(11),ename varchar(45),address varchar(45),
Dob date);
SQL>insert into employee values(1,’raj’,’vijayanagar
bengaluru’,’02-02-2017’);
SQL>desc employee
SQL>select * from employee
SQL> update employee set ename=‘Sunilkumar' where
id=1;
SQL>DELETE FROM employee WHERE id=1;
www.collaborationtech.co.in
SQL
SQL>create table student
(id int(11),sname varchar(45),address varchar(45),Dob date,age int(11));
SQL>insert into employee values(1,’kumar’,’vijayanagar mysore’,’01-02-2017’,20);
SQL>insert into employee values(2,’sunil’,’vijayanagar bangalore’,’05-02-2017’,25);
SQL>desc student
SQL>select * from student
SQL> update student set ename=‘Anilkumar' where id=2;
SQL>DELETE FROM student WHERE id=1;
SQL>create table customer
(id int(11),cname varchar(45),address varchar(45),mno varchar(45));
SQL>insert into customer values(1,’chetan’,’btm bangalore’,’9865324175’);
SQL>insert into customer values(2,guru’,’rpc layout bangalore’,’9586231475’);
SQL>desc customer
SQL>select * from customer
SQL> update customer set ename=‘Vishal' where id=2;
SQL>DELETE FROM customer WHERE id=1;
Alter Command
ALTER TABLE customer ADD Gender char(1);
ALTER TABLE customer MODIFY Location char(100);
www.collaborationtech.co.in
PL/SQL
BEGIN
dbms_output.put_line(‘Hello World..’);
END;

Declaring and usage of variables in program
DECLARE
text VARCHAR2(45);
BEGIN
text:= ‘Hello World’;
dbms_output.put_line(text);
END;

www.collaborationtech.co.in
Ratio
declare
numerator number;denominator number;
the_ratio number;
lower_limit constant number:=0.72;
samp_num constant number:=132;
BEGIN
SELECT X, Y INTO numerator, denominator from result_table where sample_id = samp_num;
the_ratio := numerator/denominator;
if the_ratio > lower_limit then
insert into ratio values(samp_num, the_ratio);
ELSE
Insert into ratio values (samp_num,-1);
END IF;commit;
exception
when zero_divide then
insert into ratio values(samp_num,0);
commit;when others then rollback; end;
www.collaborationtech.co.in
Wages
CREATE FUNCTION dept-sal (dnum NUMBER) RETURN NUMBER IS CURSOR
emp-cursor ISo
SELECT sal, comm FROM emp WHERE deptno = dnum;
total-wages NUMBER(,(:=0;
cnt NUMBER(10) :=1;
BEGIN
FOR emp-record IN emp-cursor LOOP
emp-record.comm := NVL (emp-record.comm, 0);
total-wages := total-wages + emp.record, sal+emp-record-comm;
PUT-LINE (LOOP number = '|| cnt ||', 'wages ='|| TO-CHAR (total-wages));
cnt := cnt+1;
ENDLOOP:
/* Debug Line */
PUT-LINE (Total wages ='|| TO-CHAR (total-wages));
RETURN total-wages;
END dept-sal:
www.collaborationtech.co.in
Procedures and Functions in PL/SQL
Procedure is a subprogram unit that consists of a group of PL/SQL
statements.Procedure can have a RETURN tatement to return the control to
the calling block, but it cannot return any values through the RETURN
statement.
CREATE OR REPLACE PROCEDURE welcome_msg(p_name IN
VARCHAR2)
IS
BEGIN
Dbms_output.put_line(‘Welcome’||p_name);
END

EXEC welcome_msg(‘Collaboration Technologies’);
www.collaborationtech.co.in
Follow us on Social
Facebook: https://www.facebook.com/collaborationtechnologies/
Twitter : https://twitter.com/collaboration09
Google Plus : https://plus.google.com/100704494006819853579
LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545
Instagram : https://instagram.com/collaborationtechnologies
YouTube :
https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUg
Skype : facebook:ramananda.rao.7
WhatsApp : +91 9886272445
www.collaborationtech.co.in
THANK YOU
About Us

More Related Content

What's hot (20)

PPT
TID Chapter 10 Introduction To Database
WanBK Leo
 
PPT
Database introduction
Harry Potter
 
PPTX
Introduction to DBMS(For College Seminars)
Naman Joshi
 
PPTX
Dbms and sqlpptx
thesupermanreturns
 
DOCX
Dbms Concepts
adukkas
 
PPTX
Presentation of DBMS (database management system) part 1
Junaid Nadeem
 
PPT
dbms intro
Pooja Pathak
 
PPSX
Dbms basics 02
Jaipal Dhobale
 
PPTX
Relational database revised
mnodalo
 
PPT
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Usman Tariq
 
PPTX
Database management system
9535814851
 
PDF
Intro to Database Design
Sondra Willhite
 
PPTX
dbms
PravinGhosekar
 
PPT
Dbms unit01
Ila Chandana
 
PPTX
introduction to database
Akif shexi
 
PDF
Data base management systems ppt
suthi
 
PPTX
Database management system
Sayed Ahmed
 
PPTX
Kskv kutch university DBMS unit 1 basic concepts, data,information,database,...
Dipen Parmar
 
TID Chapter 10 Introduction To Database
WanBK Leo
 
Database introduction
Harry Potter
 
Introduction to DBMS(For College Seminars)
Naman Joshi
 
Dbms and sqlpptx
thesupermanreturns
 
Dbms Concepts
adukkas
 
Presentation of DBMS (database management system) part 1
Junaid Nadeem
 
dbms intro
Pooja Pathak
 
Dbms basics 02
Jaipal Dhobale
 
Relational database revised
mnodalo
 
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Usman Tariq
 
Database management system
9535814851
 
Intro to Database Design
Sondra Willhite
 
Dbms unit01
Ila Chandana
 
introduction to database
Akif shexi
 
Data base management systems ppt
suthi
 
Database management system
Sayed Ahmed
 
Kskv kutch university DBMS unit 1 basic concepts, data,information,database,...
Dipen Parmar
 

Viewers also liked (20)

PPT
Database an introduction
Anwarul Islam, PhD
 
PDF
Database Systems - Introduction (Chapter 1)
Vidyasagar Mundroy
 
PPTX
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
PPTX
Software Testing Basics
Belal Raslan
 
PDF
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 
PPTX
Oxford Scholarship Online Access
Anwarul Islam, PhD
 
PDF
Software Engineering - 01. Introduction
Arry Arman
 
PDF
Software Engineering - Introduction and Motivation (Marcello Thiry)
Marcello Thiry
 
PDF
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
PPTX
C# programming language
swarnapatil
 
PDF
Chapter 2 Relational Data Model-part1
Eddyzulham Mahluzydde
 
PDF
Chapter 2 Relational Data Model-part 2
Eddyzulham Mahluzydde
 
PDF
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
PDF
Chapter 3 Entity Relationship Model
Eddyzulham Mahluzydde
 
PDF
Learning notes of r for python programmer (Temp1)
Chia-Chi Chang
 
PDF
Java OOP Programming language (Part 1) - Introduction to Java
OUM SAOKOSAL
 
PPTX
Introduction to Advanced Javascript
Collaboration Technologies
 
PDF
Meetup Python Nantes - les tests en python
Arthur Lutz
 
PDF
Python - Lecture 1
Ravi Kiran Khareedi
 
Database an introduction
Anwarul Islam, PhD
 
Database Systems - Introduction (Chapter 1)
Vidyasagar Mundroy
 
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
Software Testing Basics
Belal Raslan
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 
Oxford Scholarship Online Access
Anwarul Islam, PhD
 
Software Engineering - 01. Introduction
Arry Arman
 
Software Engineering - Introduction and Motivation (Marcello Thiry)
Marcello Thiry
 
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
C# programming language
swarnapatil
 
Chapter 2 Relational Data Model-part1
Eddyzulham Mahluzydde
 
Chapter 2 Relational Data Model-part 2
Eddyzulham Mahluzydde
 
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
Chapter 3 Entity Relationship Model
Eddyzulham Mahluzydde
 
Learning notes of r for python programmer (Temp1)
Chia-Chi Chang
 
Java OOP Programming language (Part 1) - Introduction to Java
OUM SAOKOSAL
 
Introduction to Advanced Javascript
Collaboration Technologies
 
Meetup Python Nantes - les tests en python
Arthur Lutz
 
Python - Lecture 1
Ravi Kiran Khareedi
 
Ad

Similar to Introduction to Database SQL & PL/SQL (20)

DOCX
Oracle 11g SQL Overview
Prathap Narayanappa
 
PDF
CS3481_Database Management Laboratory .pdf
Kirubaburi R
 
DOC
Oracle
Rajeev Uppala
 
PDF
Sql tutorial
amitabros
 
PDF
Oracle11gdevtrainingindelhincr
ducat1989
 
PPTX
Lab
neelam_rawat
 
PPT
dbs class 7.ppt
MARasheed3
 
PPT
Sql intro & ddl 1
Dr. C.V. Suresh Babu
 
PPT
Sql intro & ddl 1
Dr. C.V. Suresh Babu
 
PDF
Rdbms day3
Nitesh Singh
 
PDF
Database Management System
Hitesh Mohapatra
 
PDF
PT- Oracle session01
Karthik Venkatachalam
 
PPTX
PL_SQL - II.pptx
priyaprakash11
 
PDF
Oracle 11G Development Training noida Delhi NCR
Shri Prakash Pandey
 
PPTX
lovely
love0323
 
PPTX
Fundamentals of Database management system Lab Manual.pptx
Getnet Tigabie Askale -(GM)
 
PPTX
Unit - II.pptx
MrsSavitaKumbhare
 
PDF
dbms lab manual
stalinjothi
 
PPSX
DBMS Chapter-3.ppsx
DharmikPatel745100
 
Oracle 11g SQL Overview
Prathap Narayanappa
 
CS3481_Database Management Laboratory .pdf
Kirubaburi R
 
Sql tutorial
amitabros
 
Oracle11gdevtrainingindelhincr
ducat1989
 
dbs class 7.ppt
MARasheed3
 
Sql intro & ddl 1
Dr. C.V. Suresh Babu
 
Sql intro & ddl 1
Dr. C.V. Suresh Babu
 
Rdbms day3
Nitesh Singh
 
Database Management System
Hitesh Mohapatra
 
PT- Oracle session01
Karthik Venkatachalam
 
PL_SQL - II.pptx
priyaprakash11
 
Oracle 11G Development Training noida Delhi NCR
Shri Prakash Pandey
 
lovely
love0323
 
Fundamentals of Database management system Lab Manual.pptx
Getnet Tigabie Askale -(GM)
 
Unit - II.pptx
MrsSavitaKumbhare
 
dbms lab manual
stalinjothi
 
DBMS Chapter-3.ppsx
DharmikPatel745100
 
Ad

More from Collaboration Technologies (16)

PPTX
Introduction to Core Java Programming
Collaboration Technologies
 
PPTX
Introduction to AngularJS
Collaboration Technologies
 
PPTX
Introduction to Bootstrap
Collaboration Technologies
 
PPTX
Introduction to Hibernate Framework
Collaboration Technologies
 
PPTX
Introduction to HTML4
Collaboration Technologies
 
PPTX
Introduction to HTML5
Collaboration Technologies
 
PPTX
Introduction to JavaScript Programming
Collaboration Technologies
 
PPTX
Introduction to JPA Framework
Collaboration Technologies
 
PPTX
Introduction to jQuery
Collaboration Technologies
 
PPTX
Introduction to Perl Programming
Collaboration Technologies
 
PPTX
Introduction to PHP
Collaboration Technologies
 
PPTX
Introduction to Python Basics Programming
Collaboration Technologies
 
PPTX
Introduction to Spring Framework
Collaboration Technologies
 
PPTX
Introduction to Struts 2
Collaboration Technologies
 
PPTX
Introduction to JSON & AJAX
Collaboration Technologies
 
PPTX
Introduction to Node.JS
Collaboration Technologies
 
Introduction to Core Java Programming
Collaboration Technologies
 
Introduction to AngularJS
Collaboration Technologies
 
Introduction to Bootstrap
Collaboration Technologies
 
Introduction to Hibernate Framework
Collaboration Technologies
 
Introduction to HTML4
Collaboration Technologies
 
Introduction to HTML5
Collaboration Technologies
 
Introduction to JavaScript Programming
Collaboration Technologies
 
Introduction to JPA Framework
Collaboration Technologies
 
Introduction to jQuery
Collaboration Technologies
 
Introduction to Perl Programming
Collaboration Technologies
 
Introduction to PHP
Collaboration Technologies
 
Introduction to Python Basics Programming
Collaboration Technologies
 
Introduction to Spring Framework
Collaboration Technologies
 
Introduction to Struts 2
Collaboration Technologies
 
Introduction to JSON & AJAX
Collaboration Technologies
 
Introduction to Node.JS
Collaboration Technologies
 

Recently uploaded (20)

PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 

Introduction to Database SQL & PL/SQL

  • 1. Introduction to Database www.collaborationtech.co.in Bengaluru INDIA Presentation By Ramananda M.S Rao
  • 2. Content Content Overview Database Concepts Database Fundamentals Introduction to Database Management Systems Different Models Three Layer Architecture Data Independence, DDL, DML, DCL, Functions of DBA, DBM Introduction to ORACLE technology stack SQL Language Introduction & Using SQL*Plus SQL History and Standards, SQL Basics SQL Data Types Writing Basic SQL statements Creating and Managing Tables Insert, Update, Delete commands Alter, Drop commands Select Command Constraints www.collaborationtech.co.in
  • 3. Content SQL Operators and Functions Single row functions Aggregating data using group functions Group By clause Set Operators Joins Creating Views Subquery Nested Queries Co-related Sub-queries Controlling user access Grant and Revoke Statements Optimization and Performance SQL Tuning www.collaborationtech.co.in
  • 4. Content ER Model Assignments on E-R Model E-R to Relational Mapping Assignments on E-R to Relational Mapping Normalization Assignments on Normalization Using simple modeling Tool Building model for Simple Applications Simple Fund Management example Simple Inventory example Simple Security example PL/SQL Programming PL/SQL Variables and Constants Using %TYPE and %ROWTYPE Attributes PL/SQL Variable Scope Creating Anonymous PL/SQL Block Using DBMS_OUTPUT.PUT_LINE PL/SQL Control Structures and Variables Writing Interactive PL/SQL program Embedding SELECT Statement inside PL/SQL Block, Embedding DML Statements inside PL/SQL Block www.collaborationtech.co.in
  • 5. Content Cursors and Exceptions Cursors - Definition Cursor Using Implicit and Explicit Cursors Cursor Attributes, Cursor FOR loops, Parameterized Cursors FOR UPDATE and WHERE CURRENT OF with Explicit Cursors Exception Definition Handling user defined, Oracle predefined and non-predefined exceptions. Propagating exceptions Procedures , functions and Triggers Creating Stored Procedures and functions Invoking stored procedures Parameter Modes – IN, OUT and IN OUT Calling Stored Functions Packages Definition Packages Advantages of using Packages Components of a Package Creating and using Package www.collaborationtech.co.in
  • 6. Content Triggers - Definition Triggers Database Triggers Difference between Stored Procedure and Database Triggers Trigger Components and types Creating and using Database Triggers Objects In database Objects Types and Using Object Table Creating and Using Collection Types Dynamic SQL Native Dynamic SQL Using Packages like DBMS_OUTPUT, DBMS_PIPE, UTL_FILE, DBMS_SQL Bulk statements in PL/SQL Creating Indexes www.collaborationtech.co.in
  • 7. Overview  SQL stands for Structured Query Language.  SQL is used to communicate with a database.  SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.  SQL commands are divided into several different types, among them data manipulation language (DML) and data definition language (DDL) statements, transaction controls and security measures.  The DML vocabulary is used to retrieve and manipulate data.  DDL statements are for defining and modifying database structures. www.collaborationtech.co.in
  • 8. Overview  PL/SQL is an Oracle procedural extension for SQL. They have designed this language for easy use of complex SQL statements.  PL SQL basically stands for "Procedural Language extensions to SQL".  It combines the data manipulation power of SQL with the processing power of procedural language to create a super powerful SQL queries.  Similar to other database languages, it gives more control to the programmers by the use of loops, conditions and object oriented concepts. www.collaborationtech.co.in
  • 9. SQL SQL> create database student SQL>show database SQL>create table employee (id int(11),ename varchar(45),address varchar(45), Dob date); SQL>insert into employee values(1,’raj’,’vijayanagar bengaluru’,’02-02-2017’); SQL>desc employee SQL>select * from employee SQL> update employee set ename=‘Sunilkumar' where id=1; SQL>DELETE FROM employee WHERE id=1; www.collaborationtech.co.in
  • 10. SQL SQL>create table student (id int(11),sname varchar(45),address varchar(45),Dob date,age int(11)); SQL>insert into employee values(1,’kumar’,’vijayanagar mysore’,’01-02-2017’,20); SQL>insert into employee values(2,’sunil’,’vijayanagar bangalore’,’05-02-2017’,25); SQL>desc student SQL>select * from student SQL> update student set ename=‘Anilkumar' where id=2; SQL>DELETE FROM student WHERE id=1; SQL>create table customer (id int(11),cname varchar(45),address varchar(45),mno varchar(45)); SQL>insert into customer values(1,’chetan’,’btm bangalore’,’9865324175’); SQL>insert into customer values(2,guru’,’rpc layout bangalore’,’9586231475’); SQL>desc customer SQL>select * from customer SQL> update customer set ename=‘Vishal' where id=2; SQL>DELETE FROM customer WHERE id=1; Alter Command ALTER TABLE customer ADD Gender char(1); ALTER TABLE customer MODIFY Location char(100); www.collaborationtech.co.in
  • 11. PL/SQL BEGIN dbms_output.put_line(‘Hello World..’); END; Declaring and usage of variables in program DECLARE text VARCHAR2(45); BEGIN text:= ‘Hello World’; dbms_output.put_line(text); END; www.collaborationtech.co.in
  • 12. Ratio declare numerator number;denominator number; the_ratio number; lower_limit constant number:=0.72; samp_num constant number:=132; BEGIN SELECT X, Y INTO numerator, denominator from result_table where sample_id = samp_num; the_ratio := numerator/denominator; if the_ratio > lower_limit then insert into ratio values(samp_num, the_ratio); ELSE Insert into ratio values (samp_num,-1); END IF;commit; exception when zero_divide then insert into ratio values(samp_num,0); commit;when others then rollback; end; www.collaborationtech.co.in
  • 13. Wages CREATE FUNCTION dept-sal (dnum NUMBER) RETURN NUMBER IS CURSOR emp-cursor ISo SELECT sal, comm FROM emp WHERE deptno = dnum; total-wages NUMBER(,(:=0; cnt NUMBER(10) :=1; BEGIN FOR emp-record IN emp-cursor LOOP emp-record.comm := NVL (emp-record.comm, 0); total-wages := total-wages + emp.record, sal+emp-record-comm; PUT-LINE (LOOP number = '|| cnt ||', 'wages ='|| TO-CHAR (total-wages)); cnt := cnt+1; ENDLOOP: /* Debug Line */ PUT-LINE (Total wages ='|| TO-CHAR (total-wages)); RETURN total-wages; END dept-sal: www.collaborationtech.co.in
  • 14. Procedures and Functions in PL/SQL Procedure is a subprogram unit that consists of a group of PL/SQL statements.Procedure can have a RETURN tatement to return the control to the calling block, but it cannot return any values through the RETURN statement. CREATE OR REPLACE PROCEDURE welcome_msg(p_name IN VARCHAR2) IS BEGIN Dbms_output.put_line(‘Welcome’||p_name); END EXEC welcome_msg(‘Collaboration Technologies’); www.collaborationtech.co.in
  • 15. Follow us on Social Facebook: https://www.facebook.com/collaborationtechnologies/ Twitter : https://twitter.com/collaboration09 Google Plus : https://plus.google.com/100704494006819853579 LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545 Instagram : https://instagram.com/collaborationtechnologies YouTube : https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUg Skype : facebook:ramananda.rao.7 WhatsApp : +91 9886272445 www.collaborationtech.co.in THANK YOU