Book Review: High Performance SQL Server
As SQL Server professionals, we sometimes encounter some issues that we haven’t seen before or have seen already but forgot...
2017-10-03
405 reads
As SQL Server professionals, we sometimes encounter some issues that we haven’t seen before or have seen already but forgot...
2017-10-03
405 reads
Update: For the KPI version of this report, please check Power BI KPI Report: Hospital Charge Data
How much hospitals charge...
2016-02-16 (first published: 2016-02-09)
2,224 reads
Update: Just getting started with Power BI? You can download the Power BI Report File for this KPI Report. Please...
2016-02-16
2,190 reads
Microsoft R Server, or Revolution R Enterprise (RRE) as it is formally known, for now, is basically a platform for...
2016-02-11 (first published: 2016-02-02)
3,058 reads
Now that the Power BI Desktop is installed, let’s get some data. As of this writing, Power BI can get...
2015-09-01 (first published: 2015-08-19)
2,654 reads
This is the third installment of our Getting Started With Power BI Desktop series. The first post is about installation...
2015-08-27
827 reads
Power BI is becoming popular for a lot of reasons. Simply put, Power BI is “BI on your fingertips.” Companies looking to...
2015-08-13
1,240 reads
Here’s a quick how-to on returning temporal data set that includes missing dates. Suppose you are tasked to query an...
2015-05-29
16,394 reads
Beginning in version 2005, SQL Server is making manipulation of partitioned set of rows easier by using Window Functions (ROW_NUMBER(), aggregate functions...
2015-03-26 (first published: 2015-03-19)
6,330 reads
I committed to studying for MCSA SQL Server 2012 and taking the certification exams by the end of the year…last...
2014-10-28
624 reads
By Steve Jones
I’ve become an EV guy. I was talking with a friend who was selling...
In a previous post I talked about how we can use T-SQL Snapshot Backups...
By Steve Jones
A bit of a photo dump, but a few fun memories for me from...
Comments posted to this topic are about the item Detecting Outliers in Power BI...
Comments posted to this topic are about the item Missing Returns
Comments posted to this topic are about the item Nobody Forgot Math With Calculators
I have a few tables in my SQL 2025 database:
CREATE TABLE [dbo].[Customer] ( [CustomerID] [int] NOT NULL, [CustomerName] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [AddressKey] [int] NULL, [CustomerStatus] [int] NULL, [CustomerContact] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [ContactEmail] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [PreferredName] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [CustomerPK] PRIMARY KEY CLUSTERED ([CustomerID]) ON [PRIMARY] GO CREATE TABLE [dbo].[Orders] ( [OrderID] [int] NOT NULL, [CustomerID] [int] NOT NULL, [ProductID] [int] NOT NULL, [OrderDate] [date] NOT NULL, [Quantity] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [PK__Orders__C3905BAFE0146D59] PRIMARY KEY CLUSTERED ([OrderID]) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Customers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[Customers] ([CustomerID]) GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Products] FOREIGN KEY ([ProductID]) REFERENCES [dbo].[Products] ([ProductID]) GO CREATE TABLE dbo.CustomerReturn ( EntryID INT NOT NULL CONSTRAINT CustomerReturnPK PRIMARY KEY , CustomerID INT , ReturnDate DATETIME , OrderID INT NOT NULL ) GOThere are multiple rows in all these tables. I am trying to find how many customers have never returned anything, and I run this:
SELECT count(*)
FROM dbo.Customer
WHERE CustomerID NOT IN
(
SELECT CustomerID FROM dbo.CustomerReturn
);
I get zero rows, but I know there are customers who have not returned anything. What is wrong? See possible answers