0% found this document useful (0 votes)
11 views5 pages

87 SQL Server Except Operator

The document is a video tutorial on the SQL Server EXCEPT operator, which returns unique rows from the left query that are not present in the right query's results. It explains the requirements for using the EXCEPT operator, provides examples using SQL scripts to create tables, and demonstrates how to use the operator with single and multiple tables. The tutorial is aimed at beginners and intermediate programmers learning SQL Server, .NET, and C#.

Uploaded by

ayogbadebori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

87 SQL Server Except Operator

The document is a video tutorial on the SQL Server EXCEPT operator, which returns unique rows from the left query that are not present in the right query's results. It explains the requirements for using the EXCEPT operator, provides examples using SQL scripts to create tables, and demonstrates how to use the operator with single and multiple tables. The tutorial is aimed at beginners and intermediate programmers learning SQL Server, .NET, and C#.

Uploaded by

ayogbadebori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

3/12/2023 Sql server, .

net and c# video tutorial: SQL Server except operator


The Wayback Machine - https://web.archive.org/web/20211023172327/https://csharp-video-tutorials.blogspot.com/2015/09/sql-server-except-o…
More Create Blog Sign In

Sql server, .net and c# video tutorial


Free C#, .Net and Sql server video tutorial for beginners and intermediate programmers.

Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

SQL Server except operator

Suggested Videos
Part 84 - Handling deadlocks in ado.net
Part 85 - Retry logic for deadlock exceptions
Part 86 - How to find blocking queries in sql server

Pragim Technologies - Best software


training and placements in marathahalli,
bangalore. For further details please call
09945699393.

Complete Tutorials
How to become a full stack web
developer

Cloud computing complete tutorial

In this video we will discuss SQL Server except operator with examples. Healthy food for healthy mind and
body

JavaScript tutorial

Bootstrap tutorial

Angular tutorial for beginners

Angular 5 Tutorial for beginners

https://web.archive.org/web/20211023172327/https://csharp-video-tutorials.blogspot.com/2015/09/sql-server-except-operator.html 1/5
3/12/2023 Sql server, .net and c# video tutorial: SQL Server except operator

Important Videos
The Gift of Education

Web application for your business

How to become .NET developer

Resources available to help you

Dot Net Video Tutorials


Blazor tutorial

C tutorial

ASP.NET Core Tutorial


EXCEPT operator returns unique rows from the left query that aren’t in the right query’s
results. ASP.NET Core Razor Pages Tutorial
Introduced in SQL Server 2005
Angular 6 Tutorial
The number and the order of the columns must be the same in all queries
The data types must be same or compatible Angular CRUD Tutorial
This is similar to minus operator in oracle
Angular CLI Tutorial
Let us understand this with an example. We will use the following 2 tables for this
example. Angular 2 Tutorial

Design Patterns

SOLID Principles

ASP.NET Web API

Bootstrap

AngularJS Tutorial

jQuery Tutorial
SQL Script to create the tables
Create Table TableA JavaScript with ASP.NET Tutorial
(
JavaScript Tutorial
Id int primary key,
Name nvarchar(50),
Charts Tutorial
Gender nvarchar(10)
) LINQ
Go
LINQ to SQL
Insert into TableA values (1, 'Mark', 'Male')
Insert into TableA values (2, 'Mary', 'Female') LINQ to XML
Insert into TableA values (3, 'Steve', 'Male')
Entity Framework
Insert into TableA values (4, 'John', 'Male')
Insert into TableA values (5, 'Sara', 'Female')
WCF
Go
ASP.NET Web Services
Create Table TableB
( Dot Net Basics
Id int primary key,
Name nvarchar(50), C#
Gender nvarchar(10)
SQL Server
)
Go
ADO.NET

Insert into TableB values (4, 'John', 'Male') ASP.NET


Insert into TableB values (5, 'Sara', 'Female')
Insert into TableB values (6, 'Pam', 'Female') GridView
Insert into TableB values (7, 'Rebeka', 'Female')
Insert into TableB values (8, 'Jordan', 'Male') ASP.NET MVC
Go
Visual Studio Tips and Tricks
Notice that the following query returns the unique rows from the left query that aren’t in
Dot Net Interview Questions
the right query’s results.
Select Id, Name, Gender
Slides
https://web.archive.org/web/20211023172327/https://csharp-video-tutorials.blogspot.com/2015/09/sql-server-except-operator.html 2/5
3/12/2023 Sql server, .net and c# video tutorial: SQL Server except operator
From TableA Entity Framework
Except
Select Id, Name, Gender WCF
From TableB
ASP.NET Web Services
Result :
Dot Net Basics

C#

SQL Server

ADO.NET

ASP.NET
To retrieve all of the rows from Table B that does not exist in Table A, reverse the two
queries as shown below. GridView
Select Id, Name, Gender
ASP.NET MVC
From TableB
Except
Visual Studio Tips and Tricks
Select Id, Name, Gender
From TableA
Java Video Tutorials
Result : Part 1 : Video | Text | Slides

Part 2 : Video | Text | Slides

Part 3 : Video | Text | Slides

Interview Questions
C#

You can also use Except operator on a single table. Let's use the following SQL Server
tblEmployees table for this example.
Written Test

SQL script to create tblEmployees table


Create table tblEmployees
(
Id int identity primary key,
Name nvarchar(100),
Gender nvarchar(10),
Salary int
)
Go

Insert into tblEmployees values ('Mark', 'Male', 52000)


Insert into tblEmployees values ('Mary', 'Female', 55000)
Insert into tblEmployees values ('Steve', 'Male', 45000)
Insert into tblEmployees values ('John', 'Male', 40000)
Insert into tblEmployees values ('Sara', 'Female', 48000)
Insert into tblEmployees values ('Pam', 'Female', 60000)
Insert into tblEmployees values ('Tom', 'Male', 58000)
Insert into tblEmployees values ('George', 'Male', 65000)
Insert into tblEmployees values ('Tina', 'Female', 67000)
Insert into tblEmployees values ('Ben', 'Male', 80000)
https://web.archive.org/web/20211023172327/https://csharp-video-tutorials.blogspot.com/2015/09/sql-server-except-operator.html 3/5
3/12/2023 Sql server, .net and c# video tutorial: SQL Server except operator
Go

Result :

Order By clause should be used only once after the right query
Select Id, Name, Gender, Salary
From tblEmployees
Where Salary >= 50000
Except
Select Id, Name, Gender, Salary
From tblEmployees
Where Salary >= 60000
order By Name

No comments:

Post a Comment
It would be great if you can help share these free resources

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

https://web.archive.org/web/20211023172327/https://csharp-video-tutorials.blogspot.com/2015/09/sql-server-except-operator.html 4/5
3/12/2023 Sql server, .net and c# video tutorial: SQL Server except operator

Powered by Blogger.

https://web.archive.org/web/20211023172327/https://csharp-video-tutorials.blogspot.com/2015/09/sql-server-except-operator.html 5/5

You might also like