Advertisement
Guest User

Untitled

a guest
May 25th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. mysql> SHOW DATABASES;
  2. +--------------------+
  3. | Database |
  4. +--------------------+
  5. | information_schema |
  6. | mysql |
  7. | performance_schema |
  8. | sys |
  9. | wild_db_quest |
  10. +--------------------+
  11. 5 rows in set (0,00 sec)
  12.  
  13. mysql> USE wild_db_quest
  14. Reading table information for completion of table and column names
  15. You can turn off this feature to get a quicker startup with -A
  16.  
  17. Database changed
  18. mysql> SHOW TABLES;
  19. +-------------------------+
  20. | Tables_in_wild_db_quest |
  21. +-------------------------+
  22. | school |
  23. | wizard |
  24. +-------------------------+
  25. 2 rows in set (0,00 sec)
  26.  
  27. mysql> SELECT * FROM school
  28. -> ;
  29. Empty set (0,00 sec)
  30.  
  31. mysql> INSERT INTO school (name, country, capacity)
  32. -> VALUES ('Beauxbatons Academy of Magic', 'France', 550),
  33. -> ('Castelobruxo', 'Brazil', 380),
  34. -> ('Durmstrang Institute', 'Norway', 570),
  35. -> ('Hogwarts School of Witchcraft and Wizardry', 'United Kingdom', 450),
  36. -> ('Ilvermorny School of Witchcraft and Wizardry', 'USA', 300),
  37. -> ('Koldovstoretz', 'Russia', 125),
  38. -> ('Mahoutokoro School of Magic', 'Japan', 800),
  39. -> ('Uagadou School of Magic', 'Uganda', 350);
  40. Query OK, 8 rows affected (0,00 sec)
  41. Records: 8 Duplicates: 0 Warnings: 0
  42.  
  43. mysql> SELECT * FROM school;
  44. +----+----------------------------------------------+----------+----------------+
  45. | id | name | capacity | country |
  46. +----+----------------------------------------------+----------+----------------+
  47. | 1 | Beauxbatons Academy of Magic | 550 | France |
  48. | 2 | Castelobruxo | 380 | Brazil |
  49. | 3 | Durmstrang Institute | 570 | Norway |
  50. | 4 | Hogwarts School of Witchcraft and Wizardry | 450 | United Kingdom |
  51. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  52. | 6 | Koldovstoretz | 125 | Russia |
  53. | 7 | Mahoutokoro School of Magic | 800 | Japan |
  54. | 8 | Uagadou School of Magic | 350 | Uganda |
  55. +----+----------------------------------------------+----------+----------------+
  56. 8 rows in set (0,00 sec)
  57.  
  58. mysql> UPDATE school
  59. -> SET country='Sweden'
  60. -> WHERE id=3;
  61. Query OK, 1 row affected (0,01 sec)
  62. Rows matched: 1 Changed: 1 Warnings: 0
  63.  
  64. mysql> SELECT * FROM school;
  65. +----+----------------------------------------------+----------+----------------+
  66. | id | name | capacity | country |
  67. +----+----------------------------------------------+----------+----------------+
  68. | 1 | Beauxbatons Academy of Magic | 550 | France |
  69. | 2 | Castelobruxo | 380 | Brazil |
  70. | 3 | Durmstrang Institute | 570 | Sweden |
  71. | 4 | Hogwarts School of Witchcraft and Wizardry | 450 | United Kingdom |
  72. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  73. | 6 | Koldovstoretz | 125 | Russia |
  74. | 7 | Mahoutokoro School of Magic | 800 | Japan |
  75. | 8 | Uagadou School of Magic | 350 | Uganda |
  76. +----+----------------------------------------------+----------+----------------+
  77. 8 rows in set (0,00 sec)
  78.  
  79. mysql> UPDATE school
  80. -> SET capacity=700
  81. -> WHERE id=7;
  82. Query OK, 1 row affected (0,01 sec)
  83. Rows matched: 1 Changed: 1 Warnings: 0
  84.  
  85. mysql> SELECT * FROM school;
  86. +----+----------------------------------------------+----------+----------------+
  87. | id | name | capacity | country |
  88. +----+----------------------------------------------+----------+----------------+
  89. | 1 | Beauxbatons Academy of Magic | 550 | France |
  90. | 2 | Castelobruxo | 380 | Brazil |
  91. | 3 | Durmstrang Institute | 570 | Sweden |
  92. | 4 | Hogwarts School of Witchcraft and Wizardry | 450 | United Kingdom |
  93. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  94. | 6 | Koldovstoretz | 125 | Russia |
  95. | 7 | Mahoutokoro School of Magic | 700 | Japan |
  96. | 8 | Uagadou School of Magic | 350 | Uganda |
  97. +----+----------------------------------------------+----------+----------------+
  98. 8 rows in set (0,00 sec)
  99.  
  100. mysql> DELETE FROM school WHERE name LIKE 'Magic%';
  101. Query OK, 0 rows affected (0,00 sec)
  102.  
  103. mysql> SELECT * FROM school;
  104. +----+----------------------------------------------+----------+----------------+
  105. | id | name | capacity | country |
  106. +----+----------------------------------------------+----------+----------------+
  107. | 1 | Beauxbatons Academy of Magic | 550 | France |
  108. | 2 | Castelobruxo | 380 | Brazil |
  109. | 3 | Durmstrang Institute | 570 | Sweden |
  110. | 4 | Hogwarts School of Witchcraft and Wizardry | 450 | United Kingdom |
  111. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  112. | 6 | Koldovstoretz | 125 | Russia |
  113. | 7 | Mahoutokoro School of Magic | 700 | Japan |
  114. | 8 | Uagadou School of Magic | 350 | Uganda |
  115. +----+----------------------------------------------+----------+----------------+
  116. 8 rows in set (0,00 sec)
  117.  
  118. mysql> DELETE FROM school WHERE name LIKE '%Magic%';
  119. Query OK, 3 rows affected (0,00 sec)
  120.  
  121. mysql> SELECT * FROM school;
  122. +----+----------------------------------------------+----------+----------------+
  123. | id | name | capacity | country |
  124. +----+----------------------------------------------+----------+----------------+
  125. | 2 | Castelobruxo | 380 | Brazil |
  126. | 3 | Durmstrang Institute | 570 | Sweden |
  127. | 4 | Hogwarts School of Witchcraft and Wizardry | 450 | United Kingdom |
  128. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  129. | 6 | Koldovstoretz | 125 | Russia |
  130. +----+----------------------------------------------+----------+----------------+
  131. 5 rows in set (0,00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement