Ogrenciler Tablosundaki öğrenci bilgileri ile OgrenciNotlari tablosundaki öğrenci notları birleştirilip Anahtar1 ismi ile No değeri indexlenerek VIEW oluşturuldu. Aynı VIEW’e INDEX’ler eklemek isterseniz bunları NONCLUSTERED eklemeniz gerekir.


CREATE VIEW [dbo].[OgrencilerVeNotlari] with SCHEMABINDING as
SELECT dbo.Ogrenciler.No,dbo.Ogrenciler.AdiSoyadi,dbo.OgrenciNotlari.Notu
from dbo.Ogrenciler LEFT JOIN dbo.OgrenciNotlari on
(dbo.OgrenciNotlari.OgrenciNo=dbo.Ogrenciler.No)

CREATE UNIQUE CLUSTERED INDEX Anahtar1 ON OgrencilerVeNotlari(Ogrenci.No);

Kategoriler: Sql