Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- Query OK, 5 rows affected (0,01 sec)
- Records: 5 Duplicates: 0 Warnings: 0
- mysql> describe school;
- +----------+--------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +----------+--------------+------+-----+---------+----------------+
- | id | int(11) | NO | PRI | NULL | auto_increment |
- | name | varchar(100) | NO | | NULL | |
- | capacity | int(11) | YES | | NULL | |
- | country | varchar(255) | NO | | NULL | |
- +----------+--------------+------+-----+---------+----------------+
- 4 rows in set (0,00 sec)
- mysql> select * in school
- -> ;
- 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
- mysql> select * from school;
- +----+----------------------------------------------+----------+----------------+
- | id | name | capacity | country |
- +----+----------------------------------------------+----------+----------------+
- | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
- | 2 | BeauxBatons School of Magic | 550 | France |
- | 3 | CasteloBruxo | 380 | Brazil |
- | 4 | Durmstrang Institute | 570 | Norway |
- | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
- +----+----------------------------------------------+----------+----------------+
- 5 rows in set (0,00 sec)
- mysql> insert into school (name, country, capacity) values ('Koldovstoretz', 'Russia', 125), ('Mahoutokoro School of Magic', 'Japan', 800), ('Uagadou School of Magic', 'Uganda', 350);
- Query OK, 3 rows affected (0,01 sec)
- Records: 3 Duplicates: 0 Warnings: 0
- mysql> select * from school; +----+----------------------------------------------+----------+----------------+
- | id | name | capacity | country |
- +----+----------------------------------------------+----------+----------------+
- | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
- | 2 | BeauxBatons School of Magic | 550 | France |
- | 3 | CasteloBruxo | 380 | Brazil |
- | 4 | Durmstrang Institute | 570 | Norway |
- | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
- | 6 | Koldovstoretz | 125 | Russia |
- | 7 | Mahoutokoro School of Magic | 800 | Japan |
- | 8 | Uagadou School of Magic | 350 | Uganda |
- +----+----------------------------------------------+----------+----------------+
- 8 rows in set (0,00 sec)
- mysql> upade school
- -> set country='Sweden'
- -> where id='4';
- 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
- mysql> upade school set country='Sweden' where id=4;
- 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
- mysql> update school
- -> set country='Sweden'
- -> where id=4;
- Query OK, 1 row affected (0,00 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> update school
- -> set capacity=700
- -> where name='Mahoutokoro School of Magic';
- Query OK, 1 row affected (0,00 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> delete from school
- -> where name='%Magic%';
- Query OK, 0 rows affected (0,00 sec)
- mysql> select * from school;
- +----+----------------------------------------------+----------+----------------+
- | id | name | capacity | country |
- +----+----------------------------------------------+----------+----------------+
- | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
- | 2 | BeauxBatons School of Magic | 550 | France |
- | 3 | CasteloBruxo | 380 | Brazil |
- | 4 | Durmstrang Institute | 570 | Sweden |
- | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
- | 6 | Koldovstoretz | 125 | Russia |
- | 7 | Mahoutokoro School of Magic | 700 | Japan |
- | 8 | Uagadou School of Magic | 350 | Uganda |
- +----+----------------------------------------------+----------+----------------+
- 8 rows in set (0,00 sec)
- mysql> delete from school where name like'%Magic%'
- -> ;
- Query OK, 3 rows affected (0,01 sec)
- mysql> select * from school;
- +----+----------------------------------------------+----------+----------------+
- | id | name | capacity | country |
- +----+----------------------------------------------+----------+----------------+
- | 1 | Hogwarts School of Witchcraft and Wizardry | 400 | United Kingdom |
- | 3 | CasteloBruxo | 380 | Brazil |
- | 4 | Durmstrang Institute | 570 | Sweden |
- | 5 | Ilvermorny School of Witchcraft and Wizardry | 300 | USA |
- | 6 | Koldovstoretz | 125 | Russia |
- +----+----------------------------------------------+----------+----------------+
- 5 rows in set (0,00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement