Guest User

Untitled

a guest
Jul 22nd, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. CREATE TABLE f AS
  2. SELECT b'000000001' AS a, x'01' AS b;
  3.  
  4. `a` varbinary(2) NOT NULL,
  5. `b` varbinary(1) NOT NULL
  6.  
  7. SELECT a=0, b=0, a=b, a<>b FROM f;
  8. +-----+-----+-----+------+
  9. | a=0 | b=0 | a=b | a<>b |
  10. +-----+-----+-----+------+
  11. | 1 | 1 | 0 | 1 |
  12. +-----+-----+-----+------+
  13.  
  14. SELECT a=0, b=0, -- numeric comparisons
  15. a=b, a<>b -- BLOB comparisons; length matters
  16. FROM f;
  17.  
  18. SELECT
  19. a = 0,
  20. a = cast( 0 AS BINARY ),
  21. cast(a as SIGNED),
  22. cast(a as SIGNED) = 0,
  23. b,
  24. b = 0,
  25. b = cast( 0 AS BINARY ),
  26. cast(b as SIGNED),
  27. b = cast(b as SIGNED) = 0,
  28. a = b,
  29. a <> b
  30. FROM
  31. f;
Add Comment
Please, Sign In to add comment