Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. mysql> SELECT * FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-12-31';
  2. +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
  3. | id | firstname | lastname | birthday | birth_place | biography | is_muggle |
  4. +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
  5. | 29 | harry | potter | 1980-07-31 | london | | 0 |
  6. | 30 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
  7. | 32 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
  8. | 33 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
  9. | 34 | fred | weasley | 1978-04-01 | | | 0 |
  10. | 35 | george | weasley | 1978-04-01 | | | 0 |
  11. | 38 | drago | malefoy | 1980-06-05 | | | 0 |
  12. | 42 | 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. +-----------+
  18. | firstname |
  19. +-----------+
  20. | harry |
  21. | hermione |
  22. +-----------+
  23. 2 rows in set (0.00 sec)
  24.  
  25. mysql> SELECT firstname, lastname FROM wizard WHERE lastname LIKE 'Potter' ORDER BY firstname;
  26. +--------------+
  27. | firstname |
  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 DESC LIMIT 0,1;
  35. 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 birthday DESC LIMIT 0,1' at line 1
  36. mysql> SELECT firstname, lastname, birthday FROM wizard ORDER BY birthday ASC LIMIT 0,1;
  37. +-----------+------------+------------+
  38. | firstname | lastname | birthday |
  39. +-----------+------------+------------+
  40. | albus | dumbledore | 1881-07-01 |
  41. +-----------+------------+------------+
  42. 1 row in set (0.01 sec)
  43.  
  44. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement