Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.38 KB | None | 0 0
  1. mysql> SELECT * FROM wizard ;
  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. | 14 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
  19. +----+-----------+------------+------------+-------------+-------------------------------------------------------------+-----------+
  20. 14 rows in set (0.00 sec)
  21.  
  22. mysql> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01Amysql> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-0mysql> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-01-01' ;
  23. +-----------+----------+
  24. | firstname | lastname |
  25. +-----------+----------+
  26. | harry | potter |
  27. | hermione | granger |
  28. | ron | weasley |
  29. | ginny | weasley |
  30. | fred | weasley |
  31. | george | weasley |
  32. | drago | malefoy |
  33. | dudley | dursley |
  34. +-----------+----------+
  35. 8 rows in set (0.00 sec)
  36.  
  37. mysql> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01A
  38. '> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-12-31' ;
  39. '> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01' AND ' '> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01';
  40. '>
  41. '> ^C
  42. mysql> SELECT firstname, lastname FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-12-31' ;
  43. +-----------+----------+
  44. | firstname | lastname |
  45. +-----------+----------+
  46. | harry | potter |
  47. | hermione | granger |
  48. | ron | weasley |
  49. | ginny | weasley |
  50. | fred | weasley |
  51. | george | weasley |
  52. | drago | malefoy |
  53. | dudley | dursley |
  54. +-----------+----------+
  55. 8 rows in set (0.00 sec)
  56.  
  57. mysql> SELECT firstname, birthday
  58. -> FROM wizard
  59. -> WHERE firstname LIKE 'H%'
  60. -> ;
  61. +-----------+------------+
  62. | firstname | birthday |
  63. +-----------+------------+
  64. | harry | 1980-07-31 |
  65. | hermione | 1979-09-19 |
  66. +-----------+------------+
  67. 2 rows in set (0.00 sec)
  68.  
  69. mysql> SELECT firstname, lastname, birthday FROM wizard ORDER BY birthday ASC 0,1 ;
  70. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0,1' at line 1
  71. mysql> SELECT firstname, lastname, birthday FROM wizard ORDER BY birthday LIMIT ASC 0,1 ;
  72. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC 0,1' at line 1
  73. mysql> SELECT firstname, lastname FROM wizard ORDER BY firstname ASC WHERE lastname='potter' ;
  74. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE lastname='potter'' at line 1
  75. mysql> SELECT firstname, lastname FROM wizard WHERE lastname='potter' ORDER BY firstname ASC ;
  76. +-----------+----------+
  77. | firstname | lastname |
  78. +-----------+----------+
  79. | harry | potter |
  80. | lily | potter |
  81. +-----------+----------+
  82. 2 rows in set (0.00 sec)
  83.  
  84. mysql> SELECT firstname, lastname, birthday FROM wizard ORDER BY birthday ASC LIMIT 0,1 ;
  85. +-----------+------------+------------+
  86. | firstname | lastname | birthday |
  87. +-----------+------------+------------+
  88. | albus | dumbledore | 1881-07-01 |
  89. +-----------+------------+------------+
  90. 1 row in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement