Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created May 17, 2020 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/6d09ab19443569ef6b8390d552332e38 to your computer and use it in GitHub Desktop.
Save codecademydev/6d09ab19443569ef6b8390d552332e38 to your computer and use it in GitHub Desktop.
Codecademy export
--2
SELECT COUNT(*) AS 'Total No. Of Companies' FROM startups;
--3
SELECT SUM(valuation) AS 'Total Valuation Of All Companies' FROM startups;
--4 & 5
SELECT MAX(raised) AS 'Max Amount Of Money Raised' FROM startups
WHERE stage = 'Seed';
--6
SELECT MIN(founded) AS 'Oldest Company Foundation Year' FROM startups;
--7
SELECT AVG(valuation) AS 'Total Average Valuation' FROM startups;
--8 & 9 & 10
SELECT category, ROUND(AVG(valuation),2) AS 'Average Valuation' FROM startups
GROUP BY 1
ORDER BY 2 DESC;
--11 & 12
SELECT category, COUNT(*) AS 'Total No. Of Companies' FROM startups
GROUP BY 1
HAVING COUNT(*) > 3
ORDER BY 2 DESC;
--13
SELECT location, AVG(employees) AS 'Size Of A Startup' FROM startups
GROUP BY 1
HAVING AVG(employees) > 500
ORDER BY 2 DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment