I'd like to extract posts from Stack Overflow using Data.SE, that contain code in them. I am mainly interested in the posts that come from the tag [artificial-intelligence]. Here is the code that I wrote to do that:
select Body,PostId, Tags as 'PostTag',TagName, Posts.AcceptedAnswerId, Posts.Title
from PostTags
left join Posts
on PostTags.PostId = Posts.Id
left join Tags
on PostTags.TagId = Tags.Id
where TagName in (select
t.tagName
from tags t
left join Posts e
on t.ExcerptPostId = e.Id
left join Posts w
on t.WikiPostId = w.Id
where t.id in (3615))
and Posts.AcceptedAnswerId IS NOT NULL
However, many of these posts have no code in them. Here is my attempt to filter posts with only code. I added the following line to the query above:
and body like '%<code>%'
Does this attempt seem correct?