Skip to content

Instantly share code, notes, and snippets.

@AlenaNik
Last active May 20, 2019 13:26
Show Gist options
  • Save AlenaNik/05c9d581f95677cb33e5cb7a50095a9d to your computer and use it in GitHub Desktop.
Save AlenaNik/05c9d581f95677cb33e5cb7a50095a9d to your computer and use it in GitHub Desktop.
Instert Query:
INSERT INTO wild.school (name, country, capacity)
VALUES ('Beauxbatons Academy of Magic', 'France', 550),
('Castelobruxo', 'Brazil', 380),
('Durmstrang Institute', 'Norway', 570),
('Hogwarts School of Witchcraft and Wizardry', 'United Kingdom', 450),
('Ilvermorny School of Witchcraft and Wizardry', 'USA', 450),
('Koldovstoretz', 'Russia', 125),
('Uagadou School of Magic', 'Uganda', 350);
1) Query:
UPDATE wild.school
SET country='Sweden'
WHERE name='Durmstrang Institute';
2) Query:
UPDATE wild.school
SET capacity=700
WHERE name='Mahoutokoro School of Magic';
3) Query:
DELETE FROM wild.school
WHERE country like '%Magic%';
4) Query:
SELECT * FROM wild.school;
JSON RESULT:
[
{
"name" : "Castelobruxo",
"country" : "Brazil",
"capacity" : 380
},
{
"name" : "Durmstrang Institute",
"country" : "Sweden",
"capacity" : 570
},
{
"name" : "Hogwarts School of Witchcraft and Wizardry",
"country" : "United Kingdom",
"capacity" : 450
},
{
"name" : "Ilvermorny School of Witchcraft and Wizardry",
"country" : "USA",
"capacity" : 300
},
{
"name" : "Koldovstoretz ",
"country" : "Russia",
"capacity" : 125
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment