SELECT COUNT(*), MIN(CreationDate) AS min_date, MAX(Creat...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

SELECT COUNT(*),
	MIN(CreationDate) AS min_date,
	MAX(CreationDate) AS max_date,
	AVG(score) as avg_score
FROM posts


SELECT Name, count(Name) as "badge_count"
FROM Badges
GROUP BY Name
HAVING count(Name)>=20

Select Id, DisplayName, Location
from Users
Where Location='New York, NY'

Select CreationDate, Count(CreationDate) as "Count by Year, Month"
from PostHistory
group by CreationDate
order by
convert (DateTime,CreationDate,101) DESC

SELECT 
    DateName(mm, CreationDate) AS Month, 
    DateName(yyyy, CreationDate) AS Year, 
    COUNT(*) AS "Number of Posts" 
FROM PostHistory 
GROUP BY 
    DateName(mm, CreationDate), 
    DateName(yyyy, CreationDate) 
ORDER BY Year, Month DESC

Select YEAR(CreationDate), Month(CreationDate), Count(*)
from PostHistory
group by CreationDate
order by
convert (DateTime,CreationDate,101) DESC

SELECT format(CreationDate,'yyyy.MM'),Count(*) as "Count by Month and Year"
from PostHistory
group by format(CreationDate,'yyyy.MM') 
order by format(CreationDate,'yyyy.MM') DESC

Enter Parameters

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