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:
CREATE VIEW Braziliya_xaridorlari AS SELECT xaridor_familiyasi, xaridor_ismi FROM xaridorlar
WHERE mamlakat = "Braziliya"; DROP VIEW Braziliya;
Ishni bajarish tartibi
Maxsulot jadvalidan 4000 dan ko‘p maxsulotlarni aks ettiruvchi Viewni yaratamiz:
So`rov: Create view 2000_dan_kattalarini as select FIO from xodimlar where tugulgan_yili>2000;
Natija:
– rasm. View yaratilishi.
Tasavvur (view)ni ko‘ramiz:
So`rov: Select * from 2000_dan_kattalarini;
Natija:
– rasm. Yaratilgan Viewdagi ma‘lumotlarni ko‘rish.
Tasavvurni o‘chirish:
So`rov: Drop view 2000_dan_kattalarini;
Natija:
– rasm. Viewni ma‘lumotlar bazasidan o‘chirish.
Do'stlaringiz bilan baham: |