EXCEPT OR NOT EXIST IN ORACLE / SQL SERVER

Query :

SELECT

[Id],[Title],[Director],[boxOfficeTotal]
FROM [TestApp].[dbo].[MovieDT1]
where boxOfficeTotal > 3000
Except
SELECT ,[Title],[Director],[boxOfficeTotal]

FROM [TestApp].[dbo].[MovieDT1]
where boxOfficeTotal > 4000


Here Output of ths query like

Value between More than 3000 but less than 4000

1)  Except or Not Exist  replaces  use of NOT IN(...)
Instead of using NOT IN in statment query , you can use EXCEPT or NOT EXIST

 2) For better performance ,it works more better than left join or NOT IN

Comments

Popular posts from this blog

Add Serial no in crystal report without coding

Working with Oracle's BLOB and Microsoft's C#

File operations in C# (.net)