Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.11 KB | None | 0 0
  1. mysql> insert into school (name, country, capacity) values ('Hogwarts School of Witchcraft and Wizardry', 'United Kingdom', 400), ('BeauxBatons School of Magic', 'France', 550), ('CasteloBruxo', 'Brazil', 380), ('Durmstrang Institute', 'Norway', 570), ('Ilvermorny School of Witchcraft and Wizardry', 'USA', 300);
  2. Query OK, 5 rows affected (0,01 sec)
  3. Records: 5 Duplicates: 0 Warnings: 0
  4.  
  5. mysql> describe school;
  6. +----------+--------------+------+-----+---------+----------------+
  7. | Field | Type | Null | Key | Default | Extra |
  8. +----------+--------------+------+-----+---------+----------------+
  9. | id | int(11) | NO | PRI | NULL | auto_increment |
  10. | name | varchar(100) | NO | | NULL | |
  11. | capacity | int(11) | YES | | NULL | |
  12. | country | varchar(255) | NO | | NULL | |
  13. +----------+--------------+------+-----+---------+----------------+
  14. 4 rows in set (0,00 sec)
  15.  
  16. mysql> select * in school
  17. -> ;
  18. 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 'in school' at line 1
  19. mysql> select * from school;
  20. +----+----------------------------------------------+----------+----------------+
  21. | id | name | capacity | country |
  22. +----+----------------------------------------------+----------+----------------+
  23. | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
  24. | 2 | BeauxBatons School of Magic | 550 | France |
  25. | 3 | CasteloBruxo | 380 | Brazil |
  26. | 4 | Durmstrang Institute | 570 | Norway |
  27. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  28. +----+----------------------------------------------+----------+----------------+
  29. 5 rows in set (0,00 sec)
  30.  
  31. mysql> insert into school (name, country, capacity) values ('Koldovstoretz', 'Russia', 125), ('Mahoutokoro School of Magic', 'Japan', 800), ('Uagadou School of Magic', 'Uganda', 350);
  32. Query OK, 3 rows affected (0,01 sec)
  33. Records: 3 Duplicates: 0 Warnings: 0
  34.  
  35. mysql> select * from school; +----+----------------------------------------------+----------+----------------+
  36. | id | name | capacity | country |
  37. +----+----------------------------------------------+----------+----------------+
  38. | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
  39. | 2 | BeauxBatons School of Magic | 550 | France |
  40. | 3 | CasteloBruxo | 380 | Brazil |
  41. | 4 | Durmstrang Institute | 570 | Norway |
  42. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  43. | 6 | Koldovstoretz | 125 | Russia |
  44. | 7 | Mahoutokoro School of Magic | 800 | Japan |
  45. | 8 | Uagadou School of Magic | 350 | Uganda |
  46. +----+----------------------------------------------+----------+----------------+
  47. 8 rows in set (0,00 sec)
  48.  
  49. mysql> upade school
  50. -> set country='Sweden'
  51. -> where id='4';
  52. 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 'upade school
  53. set country='Sweden'
  54. where id='4'' at line 1
  55. mysql> upade school set country='Sweden' where id=4;
  56. 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 'upade school set country='Sweden' where id=4' at line 1
  57. mysql> update school
  58. -> set country='Sweden'
  59. -> where id=4;
  60. Query OK, 1 row affected (0,00 sec)
  61. Rows matched: 1 Changed: 1 Warnings: 0
  62.  
  63. mysql> update school
  64. -> set capacity=700
  65. -> where name='Mahoutokoro School of Magic';
  66. Query OK, 1 row affected (0,00 sec)
  67. Rows matched: 1 Changed: 1 Warnings: 0
  68.  
  69. mysql> delete from school
  70. -> where name='%Magic%';
  71. Query OK, 0 rows affected (0,00 sec)
  72.  
  73. mysql> select * from school;
  74. +----+----------------------------------------------+----------+----------------+
  75. | id | name | capacity | country |
  76. +----+----------------------------------------------+----------+----------------+
  77. | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
  78. | 2 | BeauxBatons School of Magic | 550 | France |
  79. | 3 | CasteloBruxo | 380 | Brazil |
  80. | 4 | Durmstrang Institute | 570 | Sweden |
  81. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  82. | 6 | Koldovstoretz | 125 | Russia |
  83. | 7 | Mahoutokoro School of Magic | 700 | Japan |
  84. | 8 | Uagadou School of Magic | 350 | Uganda |
  85. +----+----------------------------------------------+----------+----------------+
  86. 8 rows in set (0,00 sec)
  87.  
  88. mysql> delete from school where name like'%Magic%'
  89. -> ;
  90. Query OK, 3 rows affected (0,01 sec)
  91.  
  92. mysql> select * from school;
  93. +----+----------------------------------------------+----------+----------------+
  94. | id | name | capacity | country |
  95. +----+----------------------------------------------+----------+----------------+
  96. | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
  97. | 3 | CasteloBruxo | 380 | Brazil |
  98. | 4 | Durmstrang Institute | 570 | Sweden |
  99. | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
  100. | 6 | Koldovstoretz | 125 | Russia |
  101. +----+----------------------------------------------+----------+----------------+
  102. 5 rows in set (0,00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement