Advertisement
Guest User

Untitled

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