Advertisement
Guest User

Untitled

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