Advertisement
Guest User

Untitled

a guest
May 24th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 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. | 1 | harry | potter | 1980-07-31 | london | | 0 |
  6. | 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
  7. | 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
  8. | 5 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
  9. | 6 | fred | weasley | 1978-04-01 | | | 0 |
  10. | 7 | george | weasley | 1978-04-01 | | | 0 |
  11. | 10 | drago | malefoy | 1980-06-05 | | | 0 |
  12. | 14 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
  13. +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
  14. 8 rows in set (0,00 sec)
  15.  
  16. mysql> SELECT * FROM wizard WHERE firstname LIKE 'H%';
  17. +----+-----------+----------+------------+-------------+------------------------+-----------+
  18. | id | firstname | lastname | birthday | birth_place | biography | is_muggle |
  19. +----+-----------+----------+------------+-------------+------------------------+-----------+
  20. | 1 | harry | potter | 1980-07-31 | london | | 0 |
  21. | 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
  22. +----+-----------+----------+------------+-------------+------------------------+-----------+
  23. 2 rows in set (0,00 sec)
  24.  
  25. mysql> SELECT firstname, lastname FROM wizard WHERE lastname='potter' ORDER BY firstname ASC;
  26. +-----------+----------+
  27. | firstname | lastname |
  28. +-----------+----------+
  29. | harry | potter |
  30. | lily | potter |
  31. +-----------+----------+
  32. 2 rows in set (0,00 sec)
  33.  
  34. mysql> SELECT firstname, lastname, birthday FROM wizard ORDER BY Birthday ASC;
  35. +-----------+------------+------------+
  36. | firstname | lastname | birthday |
  37. +-----------+------------+------------+
  38. | albus | dumbledore | 1881-07-01 |
  39. | tom | jédusor | 1926-12-31 |
  40. | molly | weasley | 1949-01-01 |
  41. | arthur | weasley | 1950-02-06 |
  42. | severus | rogue | 1960-01-09 |
  43. | lily | potter | 1960-01-30 |
  44. | fred | weasley | 1978-04-01 |
  45. | george | weasley | 1978-04-01 |
  46. | hermione | granger | 1979-09-19 |
  47. | ron | weasley | 1980-03-01 |
  48. | drago | malefoy | 1980-06-05 |
  49. | dudley | dursley | 1980-06-23 |
  50. | harry | potter | 1980-07-31 |
  51. | ginny | weasley | 1981-08-11 |
  52. +-----------+------------+------------+
  53. 14 rows in set (0,00 sec)
  54.  
  55. mysql> SELECT * FROM wizard WHERE lastname='dumbledore' ORDER BY birthday DESC LIMIT 0,3;
  56. +----+-----------+------------+------------+-------------+-----------+-----------+
  57. | id | firstname | lastname | birthday | birth_place | biography | is_muggle |
  58. +----+-----------+------------+------------+-------------+-----------+-----------+
  59. | 11 | albus | dumbledore | 1881-07-01 | | | 0 |
  60. +----+-----------+------------+------------+-------------+-----------+-----------+
  61. 1 row in set (0,00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement