SlideShare a Scribd company logo
1 of 12
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
VIEWS IN SQL
WASEEM HASSAN
wazeeem456@gmail.com
www.facebook.com/waseem
hassan
twitter.com/
in.linkedin.com/in/
+919567850028
What is a view?
• A view is a “virtual” table that is derived
from other tables
• 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.
• We can add SQL functions, WHERE, and
JOIN statements to a view and present the
data as if the data were coming from one
single table
SQL CREATE VIEW SYNTAX
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition;
SQL CREATE VIEW Example
• CREATE VIEW Current_Product_
List AS
SELECT ProductID,ProductName
FROM Products
WHERE Discontinued=No;
The view "Current Product List"
lists all active products (products
that are not discontinued) from
the "Products" table. The view is
created with the following SQL
We can query the view above as follows:
• SELECT * FROM [Current Product List];
SQL Updating a View
• We can update a view by using the following syntax:
• SQL REPLACE VIEW Syntax
• REPLACE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
• SQL Dropping a View
• You can delete a view with the DROP VIEW
command.
• SQL DROP VIEW Syntax
• DROP VIEW view_name
THANK YOU……..
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

Viewers also liked (11)

Array
ArrayArray
Array
 
Liststore
ListstoreListstore
Liststore
 
Xml
XmlXml
Xml
 
Iterators and Generators
Iterators and GeneratorsIterators and Generators
Iterators and Generators
 
Storedfunctions
StoredfunctionsStoredfunctions
Storedfunctions
 
Codeigniter framework
Codeigniter framework Codeigniter framework
Codeigniter framework
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Python database connection
Python database connectionPython database connection
Python database connection
 
State management in ASP .NET
State  management in ASP .NETState  management in ASP .NET
State management in ASP .NET
 
Class diagram, use case and sequence diagram
Class diagram, use case and sequence diagramClass diagram, use case and sequence diagram
Class diagram, use case and sequence diagram
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 

Similar to Views

Admin Guiding Query Plans
Admin Guiding Query PlansAdmin Guiding Query Plans
Admin Guiding Query Plans
rsnarayanan
 
powerbioverview-191114161542.pdf
powerbioverview-191114161542.pdfpowerbioverview-191114161542.pdf
powerbioverview-191114161542.pdf
MarkMayle2
 

Similar to Views (20)

Udf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiUdf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayi
 
View
ViewView
View
 
Designing and Creating Views, Inline Functions, and Synonyms
 Designing and Creating Views, Inline Functions, and Synonyms Designing and Creating Views, Inline Functions, and Synonyms
Designing and Creating Views, Inline Functions, and Synonyms
 
Power bi slide share pdf it is a very important
Power bi slide share pdf it is a very importantPower bi slide share pdf it is a very important
Power bi slide share pdf it is a very important
 
SQL3.pdf
SQL3.pdfSQL3.pdf
SQL3.pdf
 
6232 b 04
6232 b 046232 b 04
6232 b 04
 
My sql udf,views
My sql udf,viewsMy sql udf,views
My sql udf,views
 
Combining SAS Office Analytics, SAS Visual Analytics, and SAS Studio.
Combining SAS Office Analytics, SAS Visual Analytics, and SAS Studio.Combining SAS Office Analytics, SAS Visual Analytics, and SAS Studio.
Combining SAS Office Analytics, SAS Visual Analytics, and SAS Studio.
 
Admin Guiding Query Plans
Admin Guiding Query PlansAdmin Guiding Query Plans
Admin Guiding Query Plans
 
SharePoint 2010 list improvements
SharePoint 2010 list improvementsSharePoint 2010 list improvements
SharePoint 2010 list improvements
 
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1 "Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
 
Azure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full CourseAzure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full Course
 
Oracle view
Oracle viewOracle view
Oracle view
 
Making Smarter Business Decisions with Power BI
Making Smarter Business Decisions with Power BIMaking Smarter Business Decisions with Power BI
Making Smarter Business Decisions with Power BI
 
Technical stream presentation
Technical stream presentationTechnical stream presentation
Technical stream presentation
 
powerbioverview-191114161542.pdf
powerbioverview-191114161542.pdfpowerbioverview-191114161542.pdf
powerbioverview-191114161542.pdf
 
Power BI Overview
Power BI OverviewPower BI Overview
Power BI Overview
 
Sq lite
Sq liteSq lite
Sq lite
 
Views, Triggers, Functions, Stored Procedures, Indexing and Joins
Views, Triggers, Functions, Stored Procedures,  Indexing and JoinsViews, Triggers, Functions, Stored Procedures,  Indexing and Joins
Views, Triggers, Functions, Stored Procedures, Indexing and Joins
 
Learn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design processLearn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design process
 

More from baabtra.com - No. 1 supplier of quality freshers

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Views

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. VIEWS IN SQL WASEEM HASSAN wazeeem456@gmail.com www.facebook.com/waseem hassan twitter.com/ in.linkedin.com/in/ +919567850028
  • 4. What is a view? • A view is a “virtual” table that is derived from other tables • 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. • We can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the data were coming from one single table
  • 5. SQL CREATE VIEW SYNTAX CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition;
  • 6. SQL CREATE VIEW Example • CREATE VIEW Current_Product_ List AS SELECT ProductID,ProductName FROM Products WHERE Discontinued=No; The view "Current Product List" lists all active products (products that are not discontinued) from the "Products" table. The view is created with the following SQL
  • 7. We can query the view above as follows: • SELECT * FROM [Current Product List];
  • 8. SQL Updating a View • We can update a view by using the following syntax: • SQL REPLACE VIEW Syntax • REPLACE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition
  • 9. • SQL Dropping a View • You can delete a view with the DROP VIEW command. • SQL DROP VIEW Syntax • DROP VIEW view_name
  • 11. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 12. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com