Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 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 `firstname`FROM `wizard` WHERE `firstname` LIKE 'h';
  17. Empty set (0,00 sec)
  18.  
  19. mysql> SELECT `firstname` FROM `wizard` WHERE `firstname` LIKE 'h';
  20. Empty set (0,00 sec)
  21.  
  22. mysql> SELECT `firstname` FROM `wizard` WHERE `firstname` LIKE 'H';
  23. Empty set (0,00 sec)
  24.  
  25. mysql> SELECT `firstname` FROM `wizard` WHERE `firstname` LIKE 'H%';
  26. +-----------+
  27. | firstname |
  28. +-----------+
  29. | harry |
  30. | hermione |
  31. +-----------+
  32. 2 rows in set (0,00 sec)
  33.  
  34. mysql> SELECT `firstname` `lastname` FROM `wizard` WHERE `lastname` LIKE 'potter%' ORDER BY `firstname`;
  35. +----------+
  36. | lastname |
  37. +----------+
  38. | harry |
  39. | lily |
  40. +----------+
  41. 2 rows in set (0,00 sec)
  42.  
  43. mysql> SELECT `fisrtname` `lastname` `birthday` FROM `wizard` WHERE `birthday` ORDER BY `birdthday` ASC LIMIT 1;
  44. 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 '`birthday` FROM `wizard` WHERE `birthday` ORDER BY `birdthday` ASC LIMIT 1' at line 1
  45. mysql> SELECT `fisrtname` `lastname` `birthday` FROM `wizard` ORDER BY `birdthday` ASC LIMIT 1;
  46. 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 '`birthday` FROM `wizard` ORDER BY `birdthday` ASC LIMIT 1' at line 1
  47. mysql> SELECT `firstname`, `lastname`, `birthday`, FROM `wizard` ORDER BY `birdthday` ASC LIMIT 1;
  48. 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 'FROM `wizard` ORDER BY `birdthday` ASC LIMIT 1' at line 1
  49. mysql> SELECT `firstname`, `lastname`, `birthday` FROM `wizard` ORDER BY `birthday` ASC LIMIT 1;
  50. +-----------+------------+------------+
  51. | firstname | lastname | birthday |
  52. +-----------+------------+------------+
  53. | albus | dumbledore | 1881-07-01 |
  54. +-----------+------------+------------+
  55. 1 row in set (0,00 sec)
  56.  
  57. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement