Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. # Question
  2.  
  3. Why does query 1 not return the same items as query 2? Effectively, it works the same as query 4.
  4.  
  5. ## background
  6.  
  7. MySQL Server version: 5.1.73-log Source distribution
  8.  
  9. mysql client Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
  10.  
  11. ### schema
  12. ```
  13. mysql> desc eprint;
  14. +---------------------------+---------------------+------+-----+---------+-------+
  15. | Field | Type | Null | Key | Default | Extra |
  16. +---------------------------+---------------------+------+-----+---------+-------+
  17. | eprintid | int(11) | NO | PRI | NULL | |
  18. ...
  19. | abstract_nicht_anzeigen | set('TRUE','FALSE') | YES | | NULL | |
  20. ```
  21.  
  22. ### value distribution
  23. ```
  24. mysql> select count(*),abstract_nicht_anzeigen from eprint group by abstract_nicht_anzeigen; +----------+-------------------------+
  25. | count(*) | abstract_nicht_anzeigen |
  26. +----------+-------------------------+
  27. | 19766 | NULL |
  28. | 32177 | |
  29. | 736 | TRUE |
  30. +----------+-------------------------+
  31. 3 rows in set (0.23 sec)
  32. ```
  33.  
  34. ## query 1
  35.  
  36. ```
  37. SELECT eprintid,ac_nummer,urn,thesis_type
  38. FROM eprint
  39. WHERE eprint_status="archive" and metadata_visibility="show" and date_sperre_year is null
  40. and einverstaendnis=TRUE and full_text_status="public"
  41. and abstract_nicht_anzeigen<>TRUE and urn is not null;
  42. ...
  43. 19544 rows in set (0.29 sec)
  44. ```
  45.  
  46. ## query 2
  47. ```
  48. SELECT eprintid,ac_nummer,urn,thesis_type
  49. FROM eprint
  50. WHERE eprint_status="archive" and metadata_visibility="show" and date_sperre_year is null
  51. and einverstaendnis=TRUE and full_text_status="public"
  52. and (abstract_nicht_anzeigen is NULL or abstract_nicht_anzeigen="") and urn is not null;
  53. ...
  54. 32651 rows in set (0.02 sec)
  55. ```
  56.  
  57. ## query 3
  58. ```
  59. SELECT eprintid,ac_nummer,urn,thesis_type
  60. FROM eprint
  61. WHERE eprint_status="archive" and metadata_visibility="show" and date_sperre_year is null
  62. and einverstaendnis=TRUE and full_text_status="public"
  63. and abstract_nicht_anzeigen is NULL and urn is not null;
  64. ...
  65. 13107 rows in set (0.30 sec)
  66. ```
  67.  
  68. ## query 4
  69. ```
  70. SELECT eprintid,ac_nummer,urn,thesis_type
  71. FROM eprint
  72. WHERE eprint_status="archive" and metadata_visibility="show" and date_sperre_year is null
  73. and einverstaendnis=TRUE and full_text_status="public"
  74. and abstract_nicht_anzeigen="" and urn is not null;
  75. ...
  76. 19544 rows in set (0.29 sec)
  77. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement