Skip to content

Instantly share code, notes, and snippets.

@tdmitch
Created June 16, 2020 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdmitch/b9cf8252c4abb03a00ac014ba5fa51a6 to your computer and use it in GitHub Desktop.
Save tdmitch/b9cf8252c4abb03a00ac014ba5fa51a6 to your computer and use it in GitHub Desktop.
IF (OBJECT_ID('tempdb..#Automobiles') IS NOT NULL)
DROP TABLE #Automobiles
CREATE TABLE #Automobiles
(
AutoMake VARCHAR(50) NULL
, AutoModel VARCHAR(50) NULL
, AutoType VARCHAR(50) NULL
)
INSERT #Automobiles
VALUES ('Ford', 'Mustang', 'Sedan')
, ('Datsun', '280Z', 'Coupe')
, ('Chevrolet', 'Corvette', 'Coupe')
, ('BMW', 'X5', 'SUV')
, ('Chevrolet', 'El Camino', NULL)
-- Show cars with a type other than 'Coupe' or NULL. Doesn't work like you might think!
SELECT *
FROM #Automobiles
WHERE AutoType NOT IN ('Coupe', NULL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment