Skip to content

Instantly share code, notes, and snippets.

@rriamarria
Last active November 25, 2019 19:33
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 rriamarria/a61fd09b993b16fa102e12392778f91f to your computer and use it in GitHub Desktop.
Save rriamarria/a61fd09b993b16fa102e12392778f91f to your computer and use it in GitHub Desktop.
/*Statement :
•Insert the following data into the school table(...e.g.)
•“Durmstrang Institute” is actually in Sweden (Sweden), so modify its country.
•“Mahoutokoro School of Magic” should have its pupil capacity reduced to 700.
•Delete all the schools containing the word “Magic” (there are 3) in their titles in a single request. The LIKE keyword may be of help to you.
•Then, using a SELECT query, display all of the data in the school table and paste the result in the gist along with the other results.*/
INSERT INTO school(name, country, capacity) VALUES ('Castelobruzo','Brazil',380),
('Ilvermorny School of Witchcraft and Wizardry','USA',300),
('Koldovstoretz','Russia',125),
('Mahoutokoro School of Magic','Japan',800),
('Uagadou School of Magic', 'Uganda',350),
('Beauxbatons Academy of Magic','France',550),
('Hogwarts School of Witchcraft and Wizardry','United Kingdom',450),
('Durmstrang Institute', 'Norway',570);
UPDATE school SET country="Sweden" WHERE id=7;
UPDATE school SET capacity=700 WHERE id=5;
DELETE FROM school WHERE name LIKE '%Magic';
SELECT * FROM school;
+----+----------------------------------------------+----------+----------------+
| id | name | capacity | country |
+----+----------------------------------------------+----------+----------------+
| 2 | Castelobruzo | 380 | Brazil |
| 3 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
| 4 | Koldovstoretz | 125 | Russia |
| 7 | Durmstrang Institute | 570 | Sweden |
| 8 | Hogwarts School of Witchcraft and Wizardry | 450 | United Kingdom |
+----+----------------------------------------------+----------+----------------+
5 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment