Created
April 16, 2019 11:48
-
-
Save Morzanne/f9403d40240761a8bd93ef1efe5fdacf to your computer and use it in GitHub Desktop.
BDD QUEST 2
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
mysql> SELECT * FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-01-01'; | |
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| 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 firstname FROM wizard WHERE firstname LIKE '%h'; | |
Empty set (0.00 sec) | |
mysql> SELECT firstname FROM wizard WHERE firstname LIKE 'h%'; | |
+-----------+ | |
| firstname | | |
+-----------+ | |
| harry | | |
| hermione | | |
| harry | | |
| hermione | | |
+-----------+ | |
4 rows in set (0.00 sec) | |
mysql> SELECT firstname, lastname FROM wizard WHERE lastname = 'potter'; | |
+-----------+----------+ | |
| firstname | lastname | | |
+-----------+----------+ | |
| harry | potter | | |
| lily | potter | | |
| harry | potter | | |
| lily | potter | | |
+-----------+----------+ | |
4 rows in set (0.00 sec) | |
mysql> mysql> SELECT firstname, lastname FROM wizard WHERE lastname = 'potter' ORDER BY firstname ASC; | |
+-----------+----------+ | |
| firstname | lastname | | |
+-----------+----------+ | |
| harry | potter | | |
| harry | potter | | |
| lily | potter | | |
| lily | potter | | |
+-----------+----------+ | |
4 rows in set (0.00 sec) | |
mysql> SELECT firstname, lastname FROM wizard ORDER BY birthday ASC LIMIT 1; | |
+-----------+------------+ | |
| firstname | lastname | | |
+-----------+------------+ | |
| albus | dumbledore | | |
+-----------+------------+ | |
1 row in set (0.00 sec) | |
mysql> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment