Skip to content

Instantly share code, notes, and snippets.

@Azzeccagarbugli
Created February 14, 2019 07:28
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 Azzeccagarbugli/908858e90e34d8ef414e95bab0bfe770 to your computer and use it in GitHub Desktop.
Save Azzeccagarbugli/908858e90e34d8ef414e95bab0bfe770 to your computer and use it in GitHub Desktop.
L'evoluzione della mia carriera da back-end developer
CREATE TABLE nazioni(
Code char(3) PRIMARY KEY,
Name char(52),
Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America'),
Region char(26),
SurfaceArea float(10,2));
INSERT INTO nazioni(Code, Name, Continent, Region, SurfaceArea)
SELECT Code, Name, Continent, Region, SurfaceArea
FROM world.country;
DELETE FROM nazioni
WHERE Continent = 'Europe';
SELECT *
FROM nazioni
ORDER BY Continent asc;
CREATE TABLE continenti(
NomeContinente char(52) PRIMARY KEY,
Superficie float(10,2));
INSERT INTO continenti(NomeContinente, Superficie)
VALUES ('Africa', 0), ('Asia', 0), ('Oceania', 0);
SELECT *
FROM continenti;
INSERT INTO continenti(NomeContinente, Superficie)
SELECT Continent, sum(SurfaceArea)
FROM nazioni
WHERE Continent IN ('Africa', 'Asia', 'Oceania')
GROUP BY Continent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment