Show posts for pair of tags

1

Please login or register to vote for this query.

(click on this box to dismiss)

Latin Language

Q&A for linguists, teachers, and students wanting to discuss the finer points of the Latin language

-- Declare the variable to be used.
DECLARE @A nvarchar(50);
DECLARE @B nvarchar(50);
DECLARE @AText nvarchar(50);
DECLARE @BText nvarchar(50);
-- Initialize the variables

/* 
Candidates (from highest yielding to lowest--a lot means 1000 or above):

LANG:

- c# vs java (a lot)
- python vs r (a lot)
- pandas vs r (449)

API:

- pyspark vs scala (561)

LIB:

- python vs ggplot2 (146)
- matplotlib vs ggplot2 (50)
- seaborn vs ggplot2 (15)

LIB (slightly different domain)
- pytorch vs tensorflow (61) 

*/
/*
SET @A = N'%<c#>%';
SET @B = N'%<java>%';
SET @AText = N'%c#%';
SET @BText = N'%java%';
*/

-- The reason why we use R's for BText here is because T-SQL regex is limited and %r% or %R% would match too much
-- Also bc a single letter is a terrible language name for search
-- pandas vs r is more focused than python vs r
/*
SET @A = N'%<pandas>%';
SET @B = N'%<r>%';
SET @AText = N'%pandas%';
SET @BText = N'%R''s%';
*/
-- more generic python vs r
/*
SET @A = N'%<python>%';
SET @B = N'%<r>%';
SET @AText = N'%python%';
SET @BText = N'%R''s%';
*/

/*
SET @A = N'%<pyspark>%';
SET @B = N'%<scala>%';
SET @AText = N'%pyspark%';
SET @BText = N'%scala%';
*/

/*
SET @A = N'%<python>%';
SET @B = N'%<ggplot2>%';
SET @AText = N'%python%';
SET @BText = N'%ggplot2%';
*/

/*
SET @A = N'%<pytorch>%';
SET @B = N'%<tensorflow>%';
SET @AText = N'%pytorch%';
SET @BText = N'%tensorflow%';
*/


/*
SET @A = N'%<matplotlib>%';
SET @B = N'%<ggplot2>%';
SET @AText = N'%matplotlib%';
SET @BText = N'%ggplot2%';
*/

/*
SET @A = N'%<seaborn>%';
SET @B = N'%<ggplot2>%';
SET @AText = N'%seaborn%';
SET @BText = N'%ggplot2%';
*/


-- If both tags are present OR has one of the tags with the other tag's text in the title/body
/*
SELECT distinct TOP(1000) 'http://stackoverflow.com/q/' + Cast(P.Id as varchar) as URL, P.Title, P.ViewCount, P.Score, P.AcceptedAnswerId, P.Tags, P.Body
FROM Posts P
left join PendingFlags PD on PD.PostId = P.Id 
WHERE (
(P.Tags LIKE @A AND P.Tags LIKE @B)
OR
((P.Tags LIKE @A AND (P.Title like @BText OR P.Body like @BText)) OR (P.Tags LIKE @B AND (P.Title like @AText OR P.Body like @AText)))
)
and
P.AcceptedAnswerId is not null
*/

/*
SELECT COUNT(distinct P.Id) as total
FROM Posts P
left join PendingFlags PD on PD.PostId = P.Id 
WHERE (
(P.Tags LIKE @A AND P.Tags LIKE @B)
OR
((P.Tags LIKE @A AND (P.Title like @BText OR P.Body like @BText)) OR (P.Tags LIKE @B AND (P.Title like @AText OR P.Body like @AText)))
)
and
P.AcceptedAnswerId is not null
*/
/*
SET @A = N'%<haskell>%';
SET @B = N'%<perl>%';
SET @AText = N'%haskell%';
SET @BText = N'%in perl%';

--one direction version A -> B
--SELECT COUNT(distinct P.Id) as total
SELECT distinct TOP(1000) 'http://stackoverflow.com/q/' + Cast(P.Id as varchar) as URL, P.Title, P.ViewCount, P.Score, P.AcceptedAnswerId, P.Tags, P.Body
FROM Posts P
left join PendingFlags PD on PD.PostId = P.Id 
WHERE (
--(P.Tags LIKE @A AND P.Tags LIKE @B)
--OR
(P.Tags LIKE @A AND (P.Tags LIKE @B OR P.Title like @BText OR P.Body like @BText))
--OR
--(P.Tags LIKE @B AND (P.Title like @AText OR P.Body like @AText))
)
and
P.AcceptedAnswerId is not null
*/
----


SELECT *
FROM Posts P
WHERE 
--(P.Tags LIKE '%<c>%' AND P.Tags LIKE '%<c#>%')
--OR
P.Tags LIKE '%<r>%' AND (P.Body like '/\b%>%\b/')

and
P.AcceptedAnswerId is not null

----
/*
SELECT 'http://stackoverflow.com/q/' + Cast(P.Id as varchar) as URL, P.Title, P.ViewCount, P.Score, P.AcceptedAnswerId, P.Tags, P.Body
-- SELECT COUNT(distinct P.Id)
FROM Posts P
WHERE P.PostTypeId = 1 and P.Tags LIKE '%<c#>%' and P.AcceptedAnswerId is not null
*/

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results