Upcoming speaking engagements
The last time I presented a session was at the final PASS Summit in November 2020, so it is time to get back on the virtual conference trail again....
2021-04-07
22 reads
The last time I presented a session was at the final PASS Summit in November 2020, so it is time to get back on the virtual conference trail again....
2021-04-07
22 reads
I’ve been doing SQLskills training recently, and Paul Randal (blog | Twitter) reminded our class that zeroing out a transaction log file does not use zeroes (0x00). Well, not...
2021-03-31
56 reads
For those of us who have been involved in the Microsoft Data Platform community for a few years, the events of the last few months have been dramatic, culminating...
2021-03-24
35 reads
This is my ongoing series of answering T-SQL Tuesday posts far too late to be of any use. Click here if you want to read previous entries. Paul Randal...
2021-03-17
156 reads
(If you would like to read the previous T-SQL Tuesday Retrospective entries, visit this link.) In October 2010, Sankar Reddy asked us which misconceptions we’ve been labouring under when...
2021-03-16 (first published: 2021-03-10)
324 reads
SQL Server is a complex beast, with many configuration options that can range from recommended to completely avoided. Since the release of SQL Server 2016, several options that were...
2021-03-03
79 reads
After the Professional Association of SQL Server (PASS) unceremoniously closed down in January this year and its video library & brand names were bought by Red Gate Software Ltd, it...
2021-02-24
109 reads
This Wednesday, from 5pm to 7pm Mountain Standard Time, the Calgary Data User Group is presenting two sessions for your virtual attendance. 15 minutes: A lightning talk on Kubernetes...
2021-02-22
41 reads
(Thanks to Erik Darling for reviewing this post. Check out his training materials.) One of the bigger clichés in the data professional vocabulary (behind “it depends”) is that you...
2021-04-20 (first published: 2021-02-17)
563 reads
Some years ago, I wrote about what it means to be “professional” (and that it doesn’t mean having to wear a suit and tie). Recently a conversation broke out...
2021-02-10
192 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...
Hello, We recently migrated a database from SQL Server 2014 to SQL Server 2022....
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
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