Skip to content

Instantly share code, notes, and snippets.

@barthflo
Created November 21, 2020 20:46
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 barthflo/865feece3cb5713755a18d1af54b7630 to your computer and use it in GitHub Desktop.
Save barthflo/865feece3cb5713755a18d1af54b7630 to your computer and use it in GitHub Desktop.
mysql> SELECT * FROM wizard
-> ;
+----+-----------+------------+------------+-------------+-------------------------------------------------------------+-----------+
| id | firstname | lastname | birthday | birth_place | biography | is_muggle |
+----+-----------+------------+------------+-------------+-------------------------------------------------------------+-----------+
| 1 | harry | potter | 1980-07-31 | london | | 0 |
| 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
| 3 | lily | potter | 1960-01-30 | | mother 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 |
| 7 | george | weasley | 1978-04-01 | | | 0 |
| 8 | arthur | weasley | 1950-02-06 | | | 0 |
| 9 | molly | weasley | 1949-01-01 | | | 0 |
| 10 | drago | malefoy | 1980-06-05 | | | 0 |
| 11 | albus | dumbledore | 1881-07-01 | | | 0 |
| 12 | severus | rogue | 1960-01-09 | | | 0 |
| 13 | tom | jédusor | 1926-12-31 | | Celui-Dont-On-Ne-Doit-Pas-Prononcer-Le-Nom alias Voldermort | 0 |
| 14 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
| 15 | harry | potter | 1980-07-31 | london | | 0 |
| 16 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
| 17 | lily | potter | 1960-01-30 | | mother of Harry Potter | 0 |
| 18 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
| 19 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
| 20 | fred | weasley | 1978-04-01 | | | 0 |
| 21 | george | weasley | 1978-04-01 | | | 0 |
| 22 | arthur | weasley | 1950-02-06 | | | 0 |
| 23 | molly | weasley | 1949-01-01 | | | 0 |
| 24 | drago | malefoy | 1980-06-05 | | | 0 |
| 25 | albus | dumbledore | 1881-07-01 | | | 0 |
| 26 | severus | rogue | 1960-01-09 | | | 0 |
| 27 | tom | jédusor | 1926-12-31 | | Celui-Dont-On-Ne-Doit-Pas-Prononcer-Le-Nom alias Voldermort | 0 |
| 28 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
+----+-----------+------------+------------+-------------+-------------------------------------------------------------+-----------+
28 rows in set (0.00 sec)
mysql> SELECT * FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-12-31';
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+
| id | firstname | lastname | birthday | 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 |
| 7 | george | weasley | 1978-04-01 | | | 0 |
| 10 | drago | malefoy | 1980-06-05 | | | 0 |
| 14 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
| 15 | harry | potter | 1980-07-31 | london | | 0 |
| 16 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
| 18 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
| 19 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
| 20 | fred | weasley | 1978-04-01 | | | 0 |
| 21 | george | weasley | 1978-04-01 | | | 0 |
| 24 | drago | malefoy | 1980-06-05 | | | 0 |
| 28 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+
16 rows in set (0.00 sec)
mysql> SELECT * FROM wizard WHERE firstname LIKE 'h%';
+----+-----------+----------+------------+-------------+------------------------+-----------+
| id | firstname | lastname | birthday | birth_place | biography | is_muggle |
+----+-----------+----------+------------+-------------+------------------------+-----------+
| 1 | harry | potter | 1980-07-31 | london | | 0 |
| 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
| 15 | harry | potter | 1980-07-31 | london | | 0 |
| 16 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
+----+-----------+----------+------------+-------------+------------------------+-----------+
4 rows in set (0.00 sec)
mysql> SELECT firstname, lastname FROM wizard WHERE lastname="Potter" ORDER BY firstname;
+-----------+----------+
| firstname | lastname |
+-----------+----------+
| harry | potter |
| harry | potter |
| lily | potter |
| lily | potter |
+-----------+----------+
4 rows in set (0.01 sec)
mysql> SELECT firstname, lastname, birthday FROM wizard ORDER BY birthday LIMIT 1;
+-----------+------------+------------+
| firstname | lastname | birthday |
+-----------+------------+------------+
| albus | dumbledore | 1881-07-01 |
+-----------+------------+------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment