K87L8BZBS6

Untitled

Oct 16th, 2024 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TEMP TABLE temp_comparison (
  2.     col1 INT,
  3.     col2 INT
  4. );
  5.  
  6. INSERT INTO temp_comparison (col1, col2) VALUES
  7.     (1, 1),       -- Both columns are equal
  8.     (1, 2),       -- Different values
  9.     (NULL, 1),    -- First column is NULL
  10.     (1, NULL),    -- Second column is NULL
  11.     (NULL, NULL); -- Both columns are NULL
  12.  
  13. SELECT
  14.     col1,
  15.     col2,
  16.     col1 != col2 AS not_equal,
  17.     col1 IS DISTINCT FROM col2 AS is_distinct
  18. FROM temp_comparison;
Advertisement
Add Comment
Please, Sign In to add comment