When querying data in a view, will you use the index on the columns in the entity table? Yes....
Test results
Test scripts
DECLARE @len INT = -; while @len>0BEGIN INSERT intoTeachers (TeacherName, Sex, Moneypay)VALUES ( CAST(@len as NVARCHAR),--Teachername-nvarchar (+) NULL,--Sex-bit 10000 --Moneypay-decimal ) SET @len-=1;ENDGoDECLARE @len INT = +; while @len>0BEGIN INSERT intoStudents (Stuname, Address, Birthday)VALUES(CAST(@len as NVARCHAR)+'-'+CAST(@len as NVARCHAR),--Stuname-nvarchar (+)N"',--Address-nvarchar ($) GETDATE()--Birthday-datetime ) SET @len-=1;ENDGoDECLARE @len_t INT =1;DECLARE @len_stu INT =1; while @len_t<= -BEGIN SET @len_stu=@len_t; while @len_stu>0 BEGIN INSERT intoteachandstudent (Teacherid, StudentID, Createtime)VALUES(@len_t,--Teacherid-int @len_stu,--Studentid-int GETDATE()--Createtime-datetime ) SET @len_stu-=1; END SET @len_t+=1;END------------Test:----------------SELECT * from Teachers--GO--SELECT * from Students--GO--SELECT COUNT (*) from TeachandstudentGO--CREATE VIEW vteacherandstudents-- as--SELECT--a.id as Tid,--c.id as Stuid,--A.teachername as Tname,--C.stuname as Sname--From Teachers A--INNER JOIN teachandstudent B on B.teacherid=a.id--Left JOIN Students C on c.id = B.studentidGOSELECT * fromvteacherandstudents aWHEREA.tid>Ten andA.tid< -
"The original view in MS SQL Server was" virtual table "Ha"