Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TEMP TABLE temp_comparison (
- col1 INT,
- col2 INT
- );
- INSERT INTO temp_comparison (col1, col2) VALUES
- (1, 1), -- Both columns are equal
- (1, 2), -- Different values
- (NULL, 1), -- First column is NULL
- (1, NULL), -- Second column is NULL
- (NULL, NULL); -- Both columns are NULL
- SELECT
- col1,
- col2,
- col1 != col2 AS not_equal,
- col1 IS DISTINCT FROM col2 AS is_distinct
- FROM temp_comparison;
Advertisement
Add Comment
Please, Sign In to add comment