• If you are running SQL 2005 add the index below and see what plan the engine picks...

     

    create

    nonclustered index IX_Exam_name on StudentExam(ExamName) include(StID)

    SELECT

    s.* FROM Students s

    JOIN StudentExam se

    ON s.StID=se.StID

    WHERE se.ExamName<>'SQL Server'

     

    Here's the plan with the index for the original != query...

    SELECT s.* FROM Students s   JOIN StudentExam se   ON s.StID=se.StID    WHERE se.ExamName<>'SQL Server'

      |--Nested Loops(Inner Join, OUTER REFERENCES[se].[StID]))

           |--Index Seek(OBJECT[TestingDB].[dbo].[StudentExam].[ix_Exam_name] AS [se]), SEEK[se].[ExamName] < 'SQL Server' OR [se].[ExamName] > 'SQL Server') ORDERED FORWARD)

           |--Clustered Index Seek(OBJECT[TestingDB].[dbo].[Students].[PK__Students__345EC57D] AS ), SEEK.[StID]=[TestingDB].[dbo].[StudentExam].[StID] as [se].[StID]) ORDERED FORWARD)