SlideShare a Scribd company logo
3
Most read
5
Most read
6
Most read
SQL -Views, SP, Fx
5/03/2020-
- by OmVikramThapa
Views
In DB, a view is a virtual table based on the
result-set of an SQL statement.
A view contains rows and columns, just like a
real table. The fields in a view are fields from
one or more real tables in the database.
CREATE
& CALL
CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;
SELECT * FROM [view_name];
SAMPLE
DEMO
STORED
PROCEDURE
A stored procedure is a prepared SQL code that
you can save, so the code can be reused over
and over again.
You can also pass parameters to a stored
procedure, so that the stored procedure can act
based on the parameter value(s) that is passed.
CREATE
& CALL
CREATE PROCEDURE procedure_name
BEGIN
sql_statement
END;
EXEC procedure_name;
OR
CALL procedure_name;
SAMPLE
DEMO
FUNCTIONS
SQL Functions are a way to extend MySQL with a new
function that works like a native (built-in) function such
as NOW() or CONCAT()
Functions will have the params with datatype and
always return a value with return datatype too. These
are also called as UDF (User Defined Functions)
CREATE
& CALL
CREATE FUNCTION
function_name(param param_data_type)
RETURNS data_type
BEGIN
function_statement
END;
SELECT function_name([column_name]) FROM
[table_name];
SAMPLE
DEMO
TAKEAWAY
1) VIEWS
2) STORED FUNCTIONS
3) FUNCTIONS

More Related Content

What's hot (20)

POTX
database
Shwetanshu Gupta
 
PPTX
MySql Triggers Tutorial - The Webs Academy
thewebsacademy
 
PDF
Feature Engineering in Machine Learning
Pyingkodi Maran
 
PPTX
Oracle Database View
Eryk Budi Pratama
 
PPTX
All data models in dbms
Naresh Kumar
 
PPTX
Database Design
learnt
 
PPTX
Aggregate functions in SQL.pptx
SherinRappai
 
PPTX
Oracle Database Sequence
Eryk Budi Pratama
 
PDF
Data Visualization with Tableau - by Knowledgebee Trainings
Ramesh Pabba - seeking new projects
 
PPT
Database concepts
Harry Potter
 
PPTX
Rdbms
rdbms
 
PPT
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
 
PPT
data modeling and models
sabah N
 
PPT
Dbms models
devgocool
 
PPTX
Oracle DBA
shivankuniversity
 
PPTX
4. plsql
Amrit Kaur
 
PPTX
Introduction to DAX
Ike Ellis
 
PPTX
Procedures and triggers in SQL
Vikash Sharma
 
PPTX
Indexing
myrajendra
 
database
Shwetanshu Gupta
 
MySql Triggers Tutorial - The Webs Academy
thewebsacademy
 
Feature Engineering in Machine Learning
Pyingkodi Maran
 
Oracle Database View
Eryk Budi Pratama
 
All data models in dbms
Naresh Kumar
 
Database Design
learnt
 
Aggregate functions in SQL.pptx
SherinRappai
 
Oracle Database Sequence
Eryk Budi Pratama
 
Data Visualization with Tableau - by Knowledgebee Trainings
Ramesh Pabba - seeking new projects
 
Database concepts
Harry Potter
 
Rdbms
rdbms
 
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
 
data modeling and models
sabah N
 
Dbms models
devgocool
 
Oracle DBA
shivankuniversity
 
4. plsql
Amrit Kaur
 
Introduction to DAX
Ike Ellis
 
Procedures and triggers in SQL
Vikash Sharma
 
Indexing
myrajendra
 

Similar to Sql views, stored procedure, functions (20)

PPTX
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Introduction to mysql part 4
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Sql viwes
Huda Alameen
 
PPTX
Udf&views in sql...by thanveer melayi
Muhammed Thanveer M
 
PPTX
SQL lab number 10 in database system ppt
MUHAMMADANSAR76
 
PPTX
Designing and Creating Views, Inline Functions, and Synonyms
Tayba Farooqui
 
PPTX
SQLviews in the Database Management Systems
sudeepraj620
 
PPT
chap 9 dbms.ppt
arjun431527
 
PPTX
DBMS UNIT 9.pptx..................................
VishwanathJustRockin
 
PPTX
View
LakshmiSamivel
 
PDF
Sql ch 13 - sql-views
Mukesh Tekwani
 
PPTX
V28 view
Dhirendra Chauhan
 
PDF
Sql views
Vivek Singh
 
PPTX
VIEWS.pptx
Joshi Vinay
 
PPTX
View
Pooja Dixit
 
PPT
Module05
Sridhar P
 
PPS
09 qmds2005 session13
Niit Care
 
PPTX
Concept of View in Database management system
anjanasharma77573
 
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Introduction to mysql part 4
baabtra.com - No. 1 supplier of quality freshers
 
Sql viwes
Huda Alameen
 
Udf&views in sql...by thanveer melayi
Muhammed Thanveer M
 
SQL lab number 10 in database system ppt
MUHAMMADANSAR76
 
Designing and Creating Views, Inline Functions, and Synonyms
Tayba Farooqui
 
SQLviews in the Database Management Systems
sudeepraj620
 
chap 9 dbms.ppt
arjun431527
 
DBMS UNIT 9.pptx..................................
VishwanathJustRockin
 
Sql ch 13 - sql-views
Mukesh Tekwani
 
V28 view
Dhirendra Chauhan
 
Sql views
Vivek Singh
 
VIEWS.pptx
Joshi Vinay
 
View
Pooja Dixit
 
Module05
Sridhar P
 
09 qmds2005 session13
Niit Care
 
Concept of View in Database management system
anjanasharma77573
 
Ad

More from Om Vikram Thapa (20)

PDF
Next Set of Leaders Series
Om Vikram Thapa
 
PDF
Integration Testing at go-mmt
Om Vikram Thapa
 
PDF
Understanding payments
Om Vikram Thapa
 
PDF
System Alerting & Monitoring
Om Vikram Thapa
 
PDF
Serverless computing
Om Vikram Thapa
 
PDF
Sumologic Community
Om Vikram Thapa
 
PPTX
Postman Integration Testing
Om Vikram Thapa
 
PDF
Scalibility
Om Vikram Thapa
 
PDF
5 Dysfunctions of a team
Om Vikram Thapa
 
PDF
AWS Must Know
Om Vikram Thapa
 
PDF
Continuous Feedback
Om Vikram Thapa
 
PDF
Confluence + jira together
Om Vikram Thapa
 
PDF
Understanding WhatFix
Om Vikram Thapa
 
PDF
Tech Recruitment Process
Om Vikram Thapa
 
PPTX
Jira Workshop
Om Vikram Thapa
 
PPT
Security@ecommerce
Om Vikram Thapa
 
PPT
Understanding iis part2
Om Vikram Thapa
 
PPT
Understanding iis part1
Om Vikram Thapa
 
PPT
.Net framework
Om Vikram Thapa
 
PDF
Web application
Om Vikram Thapa
 
Next Set of Leaders Series
Om Vikram Thapa
 
Integration Testing at go-mmt
Om Vikram Thapa
 
Understanding payments
Om Vikram Thapa
 
System Alerting & Monitoring
Om Vikram Thapa
 
Serverless computing
Om Vikram Thapa
 
Sumologic Community
Om Vikram Thapa
 
Postman Integration Testing
Om Vikram Thapa
 
Scalibility
Om Vikram Thapa
 
5 Dysfunctions of a team
Om Vikram Thapa
 
AWS Must Know
Om Vikram Thapa
 
Continuous Feedback
Om Vikram Thapa
 
Confluence + jira together
Om Vikram Thapa
 
Understanding WhatFix
Om Vikram Thapa
 
Tech Recruitment Process
Om Vikram Thapa
 
Jira Workshop
Om Vikram Thapa
 
Security@ecommerce
Om Vikram Thapa
 
Understanding iis part2
Om Vikram Thapa
 
Understanding iis part1
Om Vikram Thapa
 
.Net framework
Om Vikram Thapa
 
Web application
Om Vikram Thapa
 
Ad

Recently uploaded (20)

PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Designing Production-Ready AI Agents
Kunal Rai
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 

Sql views, stored procedure, functions

  • 1. SQL -Views, SP, Fx 5/03/2020- - by OmVikramThapa
  • 2. Views In DB, a view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.
  • 3. CREATE & CALL CREATE VIEW view_name AS SELECT column1, column2, ... FROM table_name WHERE condition; SELECT * FROM [view_name];
  • 5. STORED PROCEDURE A stored procedure is a prepared SQL code that you can save, so the code can be reused over and over again. You can also pass parameters to a stored procedure, so that the stored procedure can act based on the parameter value(s) that is passed.
  • 6. CREATE & CALL CREATE PROCEDURE procedure_name BEGIN sql_statement END; EXEC procedure_name; OR CALL procedure_name;
  • 8. FUNCTIONS SQL Functions are a way to extend MySQL with a new function that works like a native (built-in) function such as NOW() or CONCAT() Functions will have the params with datatype and always return a value with return datatype too. These are also called as UDF (User Defined Functions)
  • 9. CREATE & CALL CREATE FUNCTION function_name(param param_data_type) RETURNS data_type BEGIN function_statement END; SELECT function_name([column_name]) FROM [table_name];
  • 11. TAKEAWAY 1) VIEWS 2) STORED FUNCTIONS 3) FUNCTIONS