/*1.Using the posts table, find out the number of posts (...

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

/*1.Using the posts table, find out the number of posts (as num_posts), 
the minimum creation date (as min_date), the maximum creation date (as max_date), 
and average score (as avg_num_posts) */

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

/* 2.Use the badges table to show badge name (as name) 
and the number of people who won it (as badge_count), 
limiting results to badges with at least 20 winners.*/

SELECT name,
    COUNT(*) AS badge_count
FROM badges
GROUP BY name
HAVING COUNT(*) >=20;

Enter Parameters

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