Skip to content

Instantly share code, notes, and snippets.

@peppapig13132
Last active June 29, 2024 13:19
Show Gist options
  • Save peppapig13132/099cb4b1d2269644e9ed10fad76ce456 to your computer and use it in GitHub Desktop.
Save peppapig13132/099cb4b1d2269644e9ed10fad76ce456 to your computer and use it in GitHub Desktop.
HackerRank MySQL Prepare

06/29/2024

Query the total population of all cities in CITY where District is California.

SELECT SUM(POPULATION)
FROM CITY
WHERE District = 'California';

06/22/2024

SELECT
    CASE
        WHEN A + B <= C OR A + C <= B OR B + C <= A THEN 'Not A Triangle'
        WHEN A = B AND B = C THEN 'Equilateral'
        WHEN A = B OR B = C OR A = C THEN 'Isosceles'
        ELSE 'Scalene'
    END AS TriangleType
FROM TRIANGLES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment