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)

PDF
Sql ch 13 - sql-views
Mukesh Tekwani
 
PPTX
Ibm db2
aditi212
 
PPTX
1. SQL Basics - Introduction
Varun A M
 
PDF
AV/DF Advanced Security Option
DLT Solutions
 
PDF
DB12c: All You Need to Know About the Resource Manager
Andrejs Vorobjovs
 
PDF
Migration to Oracle Multitenant
Jitendra Singh
 
PPTX
Introduction to oracle database (basic concepts)
Bilal Arshad
 
PPTX
Tipos de datos en power designer
Andreita Bedoya
 
PPT
Oracle archi ppt
Hitesh Kumar Markam
 
PDF
IBM DB2 for z/OS Administration Basics
IBM
 
PPTX
InduSoft Trend Webinar
AVEVA
 
PDF
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
John Campbell
 
PPTX
오라클 DB 아키텍처와 튜닝
철민 권
 
PPT
Oracle Architecture
Neeraj Singh
 
KEY
Fundamentos de Bases de Datos - Introducción
Manuel Padilla
 
PDF
Understanding and controlling transaction logs
Red Gate Software
 
PPT
Oracle Transparent Data Encryption (TDE) 12c
Nabeel Yoosuf
 
PPT
Oracle backup and recovery
Yogiji Creations
 
Sql ch 13 - sql-views
Mukesh Tekwani
 
Ibm db2
aditi212
 
1. SQL Basics - Introduction
Varun A M
 
AV/DF Advanced Security Option
DLT Solutions
 
DB12c: All You Need to Know About the Resource Manager
Andrejs Vorobjovs
 
Migration to Oracle Multitenant
Jitendra Singh
 
Introduction to oracle database (basic concepts)
Bilal Arshad
 
Tipos de datos en power designer
Andreita Bedoya
 
Oracle archi ppt
Hitesh Kumar Markam
 
IBM DB2 for z/OS Administration Basics
IBM
 
InduSoft Trend Webinar
AVEVA
 
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
John Campbell
 
오라클 DB 아키텍처와 튜닝
철민 권
 
Oracle Architecture
Neeraj Singh
 
Fundamentos de Bases de Datos - Introducción
Manuel Padilla
 
Understanding and controlling transaction logs
Red Gate Software
 
Oracle Transparent Data Encryption (TDE) 12c
Nabeel Yoosuf
 
Oracle backup and recovery
Yogiji Creations
 

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

DOCX
Android sq lite-chapter 22
Dr. Ramkumar Lakshminarayanan
 
PPT
Chapter09
sasa_eldoby
 
PPT
Interactive SQL: SQL, Features of SQL, DDL & DML
IsakkiDeviP
 
PDF
Sql tutorial
Rumman Ansari
 
PDF
Sql
Atul Pant
 
ODP
Mysqlppt
poornima sugumaran
 
PDF
LECTURE NOTES.pdf
ChryslerPanaguiton
 
PDF
LECTURE NOTES.pdf
ChryslerPanaguiton
 
PPTX
introduction to SQL query language beginner.ppt
PatriceRochon1
 
ODP
Mysqlppt
poornima sugumaran
 
PPTX
Introduction to Oracle Database.pptx
SiddhantBhardwaj26
 
PPTX
unit 3nit unit 1_unit1_unit1_.unit 1_unit1_unit1_
townhallforme1
 
PPTX
unit 3nit unit 1_unit1_unit1_.unit 1_unit1_unit1_
townhallforme1
 
DOC
Module 3
cs19club
 
PPT
Review of SQL
Information Technology
 
ODP
Sql lite android
Dushyant Nasit
 
PPT
Chap 7
Karan Patil
 
PPT
Introduction to Threading in .Net
webhostingguy
 
PPT
Sqlapi0.1
jitendral
 
PPTX
SQL Query
Imam340267
 
Android sq lite-chapter 22
Dr. Ramkumar Lakshminarayanan
 
Chapter09
sasa_eldoby
 
Interactive SQL: SQL, Features of SQL, DDL & DML
IsakkiDeviP
 
Sql tutorial
Rumman Ansari
 
LECTURE NOTES.pdf
ChryslerPanaguiton
 
LECTURE NOTES.pdf
ChryslerPanaguiton
 
introduction to SQL query language beginner.ppt
PatriceRochon1
 
Introduction to Oracle Database.pptx
SiddhantBhardwaj26
 
unit 3nit unit 1_unit1_unit1_.unit 1_unit1_unit1_
townhallforme1
 
unit 3nit unit 1_unit1_unit1_.unit 1_unit1_unit1_
townhallforme1
 
Module 3
cs19club
 
Review of SQL
Information Technology
 
Sql lite android
Dushyant Nasit
 
Chap 7
Karan Patil
 
Introduction to Threading in .Net
webhostingguy
 
Sqlapi0.1
jitendral
 
SQL Query
Imam340267
 
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)

PPTX
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 

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