Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. mysql> SELECT * FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-01-01' AND is_muggle=0
  2. -> ;
  3. +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
  4. | id | firstname | lastname | birthday | birth_place | biography | is_muggle |
  5. +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
  6. | 1 | harry | potter | 1980-07-31 | london | | 0 |
  7. | 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
  8. | 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
  9. | 5 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
  10. | 6 | fred | weasley | 1978-04-01 | | | 0 |
  11. | 7 | george | weasley | 1978-04-01 | | | 0 |
  12. | 10 | drago | malefoy | 1980-06-05 | | | 0 |
  13. +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
  14. 7 rows in set (0.00 sec)
  15.  
  16.  
  17. mysql> SELECT firstname FROM wizard WHERE is_muggle=0 AND firstname LIKE 'H%';
  18. +-----------+
  19. | firstname |
  20. +-----------+
  21. | harry |
  22. | hermione |
  23. +-----------+
  24. 2 rows in set (0.00 sec)
  25.  
  26.  
  27. mysql> SELECT firstname, lastname FROM wizard WHERE lastname='Potter' ORDER BY firstname;
  28. +-----------+----------+
  29. | firstname | lastname |
  30. +-----------+----------+
  31. | harry | potter |
  32. | lily | potter |
  33. +-----------+----------+
  34. 2 rows in set (0.01 sec)
  35.  
  36.  
  37.  
  38. mysql> SELECT firstname, lastname, birthday FROM wizard WHERE is_muggle=0 ORDER BY birthday LIMIT 1;
  39. +-----------+------------+------------+
  40. | firstname | lastname | birthday |
  41. +-----------+------------+------------+
  42. | albus | dumbledore | 1881-07-01 |
  43. +-----------+------------+------------+
  44. 1 row in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement