SlideShare a Scribd company logo
1 of 109
UNIT-2 RELATIONAL MODEL
1.Introduction
2.Integrity constraints over relations
3.Enforcing integrity constraints
4.Querying relational data
5.Logical data base design
6.Introduction to views
7.Destroying/altering tables and views
Relational Algebra and Calculus:
1.Relational Algebra
2.Tuple relational Calculus
3.Domain relational calculus
INTRODUCTION
Integrity Constraints Over Relations
Querying Relational Data
Logical Data Base Design
VIEWS
A view is a virtual table based on the result set of an SQL statement.
• A view can contain all rows of a table or select rows
from a table.
• A view can be created from one or many tables
which depends on the written SQL query to create a
view.
Creating Views
• Database views are created using the CREATE VIEW statement.
• Views can be created from a single table, multiple tables or
another view.
• To create a view, a user must have the appropriate system
privilege according to the specific implementation.
The basic CREATE VIEW syntax is as follows −
CREATE VIEW view_name
AS SELECT column1, column2.....
FROM table_name
WHERE [condition];
You can include multiple tables in your SELECT statement in a
similar way as you use them in a normal SQL SELECT query.
Example
Consider the CUSTOMERS table having the following records −
Following is an example to create a view from the CUSTOMERS
table.
This view would be used to have customer name and age from
the CUSTOMERS table.
CREATE VIEW CUSTOMERS_VIEW
AS SELECT name, age
FROM CUSTOMERS;
SELECT * FROM CUSTOMERS_VIEW;
Updating a View
UPDATE CUSTOMERS_VIEW
SET AGE = 35
WHERE name = 'Ramesh';
DELETE FROM CUSTOMERS_VIEW
WHERE age = 22;
• DROP VIEW view_name;
• DROP VIEW CUSTOMERS_VIEW;
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbds
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbds
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbds

More Related Content

Similar to foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbds

Similar to foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbds (20)

chap 9 dbms.ppt
chap 9 dbms.pptchap 9 dbms.ppt
chap 9 dbms.ppt
 
WebBasedQueryBuilder_v1.0.pptx
WebBasedQueryBuilder_v1.0.pptxWebBasedQueryBuilder_v1.0.pptx
WebBasedQueryBuilder_v1.0.pptx
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL II
 
View
ViewView
View
 
World2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewWorld2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverview
 
Implementing views
Implementing views Implementing views
Implementing views
 
View
ViewView
View
 
Advance SQL.pptx
Advance SQL.pptxAdvance SQL.pptx
Advance SQL.pptx
 
SQL Server Views
SQL Server ViewsSQL Server Views
SQL Server Views
 
Sql server indexed views speed up your select queries part 1 - code-projec
Sql server indexed views   speed up your select queries  part 1 - code-projecSql server indexed views   speed up your select queries  part 1 - code-projec
Sql server indexed views speed up your select queries part 1 - code-projec
 
Views
ViewsViews
Views
 
02 database oprimization - improving sql performance - ent-db
02  database oprimization - improving sql performance - ent-db02  database oprimization - improving sql performance - ent-db
02 database oprimization - improving sql performance - ent-db
 
Access tips access and sql part 1 setting the sql scene
Access tips  access and sql part 1  setting the sql sceneAccess tips  access and sql part 1  setting the sql scene
Access tips access and sql part 1 setting the sql scene
 
Module08
Module08Module08
Module08
 
Module08
Module08Module08
Module08
 
Sql viwes
Sql viwesSql viwes
Sql viwes
 
Sql2
Sql2Sql2
Sql2
 
Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005
 
4) databases
4) databases4) databases
4) databases
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*Plus
 

Recently uploaded

4th QT WEEK 2 Cook Meat Cuts part 2.pptx
4th QT WEEK 2 Cook Meat Cuts part 2.pptx4th QT WEEK 2 Cook Meat Cuts part 2.pptx
4th QT WEEK 2 Cook Meat Cuts part 2.pptxKattieAlisonMacatugg1
 
Russian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...
VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...
VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...Suhani Kapoor
 
VIP Kolkata Call Girl Jadavpur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Jadavpur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Jadavpur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Jadavpur 👉 8250192130 Available With Roomdivyansh0kumar0
 
THE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDY
THE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDYTHE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDY
THE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDYHumphrey A Beña
 
(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Grade Eight Quarter 4_Week 6_Cookery.pptx
Grade Eight Quarter 4_Week 6_Cookery.pptxGrade Eight Quarter 4_Week 6_Cookery.pptx
Grade Eight Quarter 4_Week 6_Cookery.pptxKurtGardy
 
Low Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service NashikLow Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service Nashikranjana rawat
 
Assessment on SITXINV007 Purchase goods.pdf
Assessment on SITXINV007 Purchase goods.pdfAssessment on SITXINV007 Purchase goods.pdf
Assessment on SITXINV007 Purchase goods.pdfUMER979507
 
High Class Call Girls Nashik Priya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Priya 7001305949 Independent Escort Service NashikHigh Class Call Girls Nashik Priya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Priya 7001305949 Independent Escort Service Nashikranjana rawat
 
VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130
VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130
VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Dubai &ubble O525547819 Call Girls In Dubai Blastcum
Call Girls Dubai &ubble O525547819 Call Girls In Dubai BlastcumCall Girls Dubai &ubble O525547819 Call Girls In Dubai Blastcum
Call Girls Dubai &ubble O525547819 Call Girls In Dubai Blastcumkojalkojal131
 
Call Girl Nashik Khushi 7001305949 Independent Escort Service Nashik
Call Girl Nashik Khushi 7001305949 Independent Escort Service NashikCall Girl Nashik Khushi 7001305949 Independent Escort Service Nashik
Call Girl Nashik Khushi 7001305949 Independent Escort Service Nashikranjana rawat
 
VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...
VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...
VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...Call Girls in Nagpur High Profile
 
ΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ Ξ
ΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ ΞΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ Ξ
ΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ Ξlialiaskou00
 
Russian Call Girls in Nashik Riya 7001305949 Independent Escort Service Nashik
Russian Call Girls in Nashik Riya 7001305949 Independent Escort Service NashikRussian Call Girls in Nashik Riya 7001305949 Independent Escort Service Nashik
Russian Call Girls in Nashik Riya 7001305949 Independent Escort Service Nashikranjana rawat
 
(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service
(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service
(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Recently uploaded (20)

young Whatsapp Call Girls in Jamuna Vihar 🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Jamuna Vihar 🔝 9953056974 🔝 escort serviceyoung Whatsapp Call Girls in Jamuna Vihar 🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Jamuna Vihar 🔝 9953056974 🔝 escort service
 
4th QT WEEK 2 Cook Meat Cuts part 2.pptx
4th QT WEEK 2 Cook Meat Cuts part 2.pptx4th QT WEEK 2 Cook Meat Cuts part 2.pptx
4th QT WEEK 2 Cook Meat Cuts part 2.pptx
 
Russian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Devyani Call 7001035870 Meet With Nagpur Escorts
 
VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...
VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...
VIP Russian Call Girls in Cuttack Deepika 8250192130 Independent Escort Servi...
 
VIP Kolkata Call Girl Jadavpur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Jadavpur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Jadavpur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Jadavpur 👉 8250192130 Available With Room
 
THE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDY
THE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDYTHE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDY
THE ARTISANAL SALT OF SAN VICENTE, ILOCOS SUR: A CASE STUDY
 
(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(ASHA) Sb Road Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call Girls In Ramesh Nagar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Ramesh Nagar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCeCall Girls In Ramesh Nagar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Ramesh Nagar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
 
Grade Eight Quarter 4_Week 6_Cookery.pptx
Grade Eight Quarter 4_Week 6_Cookery.pptxGrade Eight Quarter 4_Week 6_Cookery.pptx
Grade Eight Quarter 4_Week 6_Cookery.pptx
 
Low Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service NashikLow Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Mahima 7001305949 Independent Escort Service Nashik
 
Assessment on SITXINV007 Purchase goods.pdf
Assessment on SITXINV007 Purchase goods.pdfAssessment on SITXINV007 Purchase goods.pdf
Assessment on SITXINV007 Purchase goods.pdf
 
High Class Call Girls Nashik Priya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Priya 7001305949 Independent Escort Service NashikHigh Class Call Girls Nashik Priya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Priya 7001305949 Independent Escort Service Nashik
 
VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130
VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130
VIP Call Girls Service Secunderabad Hyderabad Call +91-8250192130
 
Call Girls Dubai &ubble O525547819 Call Girls In Dubai Blastcum
Call Girls Dubai &ubble O525547819 Call Girls In Dubai BlastcumCall Girls Dubai &ubble O525547819 Call Girls In Dubai Blastcum
Call Girls Dubai &ubble O525547819 Call Girls In Dubai Blastcum
 
Call Girl Nashik Khushi 7001305949 Independent Escort Service Nashik
Call Girl Nashik Khushi 7001305949 Independent Escort Service NashikCall Girl Nashik Khushi 7001305949 Independent Escort Service Nashik
Call Girl Nashik Khushi 7001305949 Independent Escort Service Nashik
 
VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...
VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...
VVIP Pune Call Girls Viman Nagar (7001035870) Pune Escorts Nearby with Comple...
 
Dwarka Sector 14 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Dwarka Sector 14 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceDwarka Sector 14 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Dwarka Sector 14 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
ΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ Ξ
ΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ ΞΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ Ξ
ΦΑΓΗΤΟ ΤΕΛΕΙΟ ΞΞΞΞΞΞΞ ΞΞΞΞΞΞ ΞΞΞΞ ΞΞΞΞ Ξ
 
Russian Call Girls in Nashik Riya 7001305949 Independent Escort Service Nashik
Russian Call Girls in Nashik Riya 7001305949 Independent Escort Service NashikRussian Call Girls in Nashik Riya 7001305949 Independent Escort Service Nashik
Russian Call Girls in Nashik Riya 7001305949 Independent Escort Service Nashik
 
(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service
(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service
(AARUSHI) Call Girls Shikrapur ( 7001035870 ) HI-Fi Pune Escorts Service
 

foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbds

  • 1. UNIT-2 RELATIONAL MODEL 1.Introduction 2.Integrity constraints over relations 3.Enforcing integrity constraints 4.Querying relational data 5.Logical data base design 6.Introduction to views 7.Destroying/altering tables and views Relational Algebra and Calculus: 1.Relational Algebra 2.Tuple relational Calculus 3.Domain relational calculus
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96. VIEWS
  • 97. A view is a virtual table based on the result set of an SQL statement.
  • 98. • A view can contain all rows of a table or select rows from a table. • A view can be created from one or many tables which depends on the written SQL query to create a view.
  • 99. Creating Views • Database views are created using the CREATE VIEW statement. • Views can be created from a single table, multiple tables or another view. • To create a view, a user must have the appropriate system privilege according to the specific implementation.
  • 100. The basic CREATE VIEW syntax is as follows − CREATE VIEW view_name AS SELECT column1, column2..... FROM table_name WHERE [condition]; You can include multiple tables in your SELECT statement in a similar way as you use them in a normal SQL SELECT query.
  • 101. Example Consider the CUSTOMERS table having the following records −
  • 102. Following is an example to create a view from the CUSTOMERS table. This view would be used to have customer name and age from the CUSTOMERS table. CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM CUSTOMERS;
  • 103. SELECT * FROM CUSTOMERS_VIEW;
  • 104. Updating a View UPDATE CUSTOMERS_VIEW SET AGE = 35 WHERE name = 'Ramesh';
  • 106. • DROP VIEW view_name; • DROP VIEW CUSTOMERS_VIEW;