2

One can use different programming languages for Android app development and I am choosing which to learn. Of course, I want to learn a popular language with a big community and I think the number of posts on SO are a good indicator for this. Thus, my question is: Is there a way to find out which tags were used most frequently with the tag ? So what I am looking for will have the form " x times used with , y times used with , ...". Further, to take into consideration the time aspect, can this search be limited to the last year, for example?

Side note: You may find the number of posts a bad indicator for what is a good programming language. Still, I wonder how one technically could find out with which other tag was used most often.

0

3 Answers 3

6

Let me try a different approach. We count how often the combination of tags is used on questions. That will show how a combination of tags is commonly used which can learn us more about interesting topics.

Here is the somewhat rough query (don't pay attention to its revision history) (I think I'm over counting rows but I can't find where):

declare @tagid integer = (select id from tags where tagname = ##tagname:string##)
declare @years integer = ##year:int?1##

;with postswithtag as (
  select pt.postid, p2.tagid
  from posttags pt
  inner join posts p on p.id = pt.postid
  inner join posttags p2 
     on p2.postid = pt.postid 
    and p2.tagid <> @tagid
  where pt.tagid = @tagid
  and p.creationdate between dateadd(yy, -@years, getdate()) and getdate()
)

select cnt [Number of Posts]
     , t1.tagname
     , t2.tagname
     , t3.tagname
     , t4.tagname
     , t5.tagname
from (
  select count(distinct postid) [cnt], [1], [2], [3], [4], [5]
  from(
    select postid, [1], [2], [3], [4], [5]
    from (
      select tagid
           , postid
           , row_number() over(partition by postid order by count desc) [row]
      from postswithtag pt
      inner join tags t on t.id = pt.tagid
    ) data
    pivot (
       min(tagid) 
       for row in ( [1], [2], [3], [4], [5])
    ) pvt
  ) total
  group by [1],[2],[3],[4],[5]
) tag_cols
inner join tags t1 on t1.id = [1]
left outer join tags t2 on t2.id = [2]
left outer join tags t3 on t3.id = [3]
left outer join tags t4 on t4.id = [4]
left outer join tags t5 on t5.id = [5]
order by cnt desc

When run today this is the result for the Android tag:

tables with count and 5 columns with tag names

So this should tell you the frequency of the combination of tags in posts tagged with Android. Give or take counting errors.

3
  • 1
    Arguably you could drop [5]. You're excluding the tag you're searching for so there's a max of 4 (remaining) tags that can be on a question (not really impacting the results, just a little bit of extra work there.)
    – Henry Ecker Mod
    Apr 12 at 0:28
  • @HenryEcker yeah, in an ideal world. Welcome to Stack Overflows data management: data.stackexchange.com/stackoverflow/query/1736820
    – rene
    Apr 12 at 17:17
  • Well then it looks like you're missing a [6] and [7] column xD
    – Henry Ecker Mod
    Apr 12 at 18:39
7

Yes. Use the Data Explorer.

Here ya go :D

https://data.stackexchange.com/stackoverflow/query/1735629/sibling-tag-counts-for-a-given-tag-in-the-past-365-days?tagname=android

DECLARE @tagname NVARCHAR(MAX) = ##tagname:string##
DECLARE @tagid INT = (SELECT T.Id FROM Tags T WHERE T.TagName = @tagname)

SELECT
  MAX(T.TagName) AS Name,
  COUNT(PT.TagId) AS Count
FROM Posts Q
JOIN PostTags PT ON PT.PostId = Q.Id
JOIN Tags T ON T.Id = PT.TagId
WHERE
  Q.PostTypeId = 1
  AND Q.CreationDate > DATEADD(year, -1, getdate())
  AND Q.Tags like '%<'+@tagname+'>%'
  AND PT.TagId <> @tagid
GROUP BY PT.TagId
--HAVING COUNT(PT.TagId) > 5
ORDER BY COUNT(PT.TagId) DESC
;

Top few results from last SEDE refresh that time of this writing:

tag name count
kotlin 11455
java 9697
flutter 5300
android-studio 4985
android-jetpack-compose 3447
react-native 3024
firebase 2823
dart 2067
ios 1796
gradle 1784
android-recyclerview 1477
android-layout 1112
xml 1082
firebase-realtime-database 902
android-fragments 898
javascript 889
android-room 705
google-cloud-firestore 689
mobile 680
google-play 666
c# 649

The magic-8 ball says you should learn some Kotlin.

1
  • Actually java is not that far off and then there is a big drop.. Thanks for that!
    – Ingo Pingo
    Apr 11 at 7:54
5

As already answered, Data Explorer will give you the most in-depth information here, but the simple all-time sibling tag stats are available on the lower right-hand side of every tag-only question search page, under the "Related Tags" heading:

Related Tags for Java

(It even shows up for multi-tag searches!)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .