Advertisement
Guest User

SQL Queries Tag Indonesia

a guest
Jan 3rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. Count Total Accounts in Steem :
  2.  
  3. SELECT COUNT(*) as total_account
  4. from Accounts
  5.  
  6. ---
  7. Count Total Accounts using tag indonesia as main category:
  8.  
  9. select COUNT(*) as total_account from
  10. (
  11. select author, COUNT(*) as total_post
  12. from
  13. Comments (NOLOCK)
  14. where
  15. depth = 0
  16. AND category='indonesia'
  17. group by author
  18. ) a
  19.  
  20. ---
  21. Count Total Accounts using tag indonesia:
  22.  
  23. select COUNT(*) as total_account from
  24. (
  25. select author, COUNT(*) as total_post
  26. from
  27. Comments (NOLOCK)
  28. where
  29. depth = 0
  30. AND ISJSON(json_metadata) > 0
  31. AND (JSON_QUERY(json_metadata,'$.tags') like '%"indonesia"%' OR category = 'indonesia')
  32. group by author
  33. ) a
  34.  
  35. ---
  36. Count Total main category in Steem:
  37.  
  38. select COUNT(*) as total_category from (
  39. select category, COUNT(*) as total_post
  40. from
  41. Comments (NOLOCK)
  42. where
  43. depth = 0
  44. group by
  45. category
  46. ) a
  47.  
  48. ---
  49. Count Total posts :
  50.  
  51.  
  52. select COUNT(*) as total_post
  53. from
  54. Comments (NOLOCK)
  55. where
  56. depth = 0
  57.  
  58. ---
  59. Count Total posts using tag Indonesia as main category:
  60.  
  61. select category, COUNT(*) as total_post
  62. from
  63. Comments (NOLOCK)
  64. where
  65. depth = 0
  66. AND category = 'indonesia'
  67. group by
  68. category
  69.  
  70. ---
  71. Count Total posts using tag Indonesia :
  72.  
  73. select COUNT(*) as total_post
  74. from
  75. Comments (NOLOCK)
  76. where
  77. depth = 0
  78. AND ISJSON(json_metadata) > 0
  79. AND (JSON_QUERY(json_metadata,'$.tags') like '%"indonesia"%' OR category = 'indonesia')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement