DECLARE @rep_threshold AS Int = 10000 SELECT c.Text, c.U...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @rep_threshold AS Int = 10000

SELECT 
  c.Text, c.UserId
  INTO #coms
FROM Comments c
JOIN Users u ON u.Id = c.UserId
WHERE
  c.CreationDate > '09/11/19' AND
  c.CreationDate < '10/11/19' AND
  u.Reputation > @rep_threshold
  
DECLARE @total_users AS Int
DECLARE @total_comments AS Int
DECLARE @gendered_comments AS Int

SELECT @total_users = COUNT(DISTINCT UserId) FROM #coms
SELECT @total_comments = COUNT(*) FROM #coms
SELECT @gendered_comments = COUNT(*) FROM #coms c
WHERE 
   c.Text LIKE '%[^a-zA-Z0-9][Hh]e[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9][Hh]im[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9][Hh]is[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9][Ss]he[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9][Hh]er[^a-zA-Z0-9]%'

SELECT (@gendered_comments * 100. / @total_comments) AS 'Gendered Percent',
        @total_comments / @total_users AS 'Comments/user',
        @total_users AS 'Total Users',
        @gendered_comments AS 'Gendered Comments',
        @total_comments AS 'Total Comments'

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results