mysql> SELECT * FROM wizard WHERE is_muggle = 0 AND birthdate BETWEEN '1975-01-01' AND '1985-01-01';
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+
| id | firstname | lastname | birthdate | birth_place | biography | is_muggle |
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+
| 1 | harry | potter | 1980-07-31 | london | | 0 |
| 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
| 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
| 5 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
| 6 | fred | weasley | 1978-04-01 | | | 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class person { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
tellMyName() { | |
return `I am ${this.name}.`; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT team.name as name, COUNT(player.id) as nb_player FROM player | |
INNER JOIN team ON player.team_id = team.id | |
GROUP BY team.name ORDER BY nb_player DESC; | |
+------------+-----------+ | |
| name | nb_player | | |
+------------+-----------+ | |
| Gryffindor | 36 | | |
| Slytherin | 21 | | |
| Ravenclaw | 15 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT wizard.firstname as firstname, wizard.lastname as lastname, player.role as role, team.name as team | |
FROM wizard | |
INNER JOIN player ON wizard.id = player.wizard_id INNER JOIN team ON team.id = player.team_id | |
ORDER BY team.name, player.role, wizard.lastname, wizard.firstname; | |
+-------------+-----------------+--------+------------+ | |
| firstname | lastname | role | team | | |
+-------------+-----------------+--------+------------+ | |
| Sirius | Black | beater | Gryffindor | | |
| Lavender | Brown | beater | Gryffindor | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO school (id, name, capacity, country) VALUES | |
(NULL, 'Beauxbatons Academy of Magic', '550', 'France'), | |
(NULL, 'Castelobruxo', '380', 'Brazil'), | |
(NULL, 'Durmstrang Institute', '570', 'Norway'), | |
(NULL, 'Hogwarts School of Witchcraft and Wizardry', '450', 'United Kingdom'), | |
(NULL, 'Ilvermorny School of Witchcraft and Wizardry', '300', 'USA'), | |
(NULL, 'Koldovstoretz', '125', 'Russia'), | |
(NULL, 'Mahoutokoro School of Magic', '800', 'Japan'), | |
(NULL, 'Uagadou School of Magic', '350', 'Uganda'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Class Personne | |
{ | |
// Attributs | |
public $lastname; | |
public $firstname; | |
public $adress; | |
public $birthday; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM movie WHERE id=5; | |
DELETE FROM movie WHERE id > 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE movie SET name='Men in Black' WHERE id = 5; | |
UPDATE movie | |
SET name='Deadpool', poster='https://upload.wikimedia.org/wikipedia/en/thumb/2/23/Deadpool_%282016_poster%29.png/220px-Deadpool_%282016_poster%29.png' | |
WHERE id=8; | |
UPDATE movie | |
SET comment="" | |
WHERE id=10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO movie VALUES ('la guerre des etoiles', 'stargate', 'interstellar'); | |
INSERT INTO movie (name, poster, comment) VALUES ('hello', 'je sais pas', 'cest un film sa'); | |
INSERT INTO movie (name, poster, comment) VALUES | |
('les visiteur', 'ok', 'sympa'), | |
('les visiteurs 2', 'OK', 'bof'), | |
('les visiteur 3', 'ok ok', 'nul'); | |
INSERT INTO movie (name) VALUES ('les visiteur 58'); |