VIEW yaratish va o‟chirishning so‟rovi sintaksisi
CREATE VIEW tasavvur_nomi AS
SELECT ustun1, ustun2, ...
FROM jadval_nomi
WHERE shartli_tenglik;
DROP VIEW tasavvur_nomi;
Masalan:
85
CREATE VIEW Braziliya_xaridorlari AS
SELECT xaridor_familiyasi, xaridor_ismi
FROM xaridorlar
WHERE mamlakat = "Braziliya";
DROP VIEW Braziliya;
Ishni bajarish tartibi
1.
Maxsulot jadvalidan 4000 dan ko‘p maxsulotlarni aks ettiruvchi
Viewni yaratamiz:
So`rov: Create view 4000_kg_kop_maxsulotlar as select
maxsulot_nomi, ogirligi_kg, from maxsulot where
ogirligi_kg>4000;
Natija:
15.1 – rasm. View yaratilishi.
2.
Tasavvur (view)ni ko‘ramiz:
So`rov: Select * from 4000_kg_dan_kop_maxsulotlar;
Natija:
15.2 – rasm. Yaratilgan Viewdagi ma‘lumotlarni ko‘rish.
3.
Tasavvurni o‘chirish:
So`rov: Drop view 4000_kg_dan_kop_maxsulotlar;
Natija:
15.3 – rasm. Viewni ma‘lumotlar bazasidan o‘chirish.
86
Do'stlaringiz bilan baham: |