Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ➜ ~ mysql -u root -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 10
- Server version: 8.0.16 MySQL Community Server - GPL
- Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- mysql> CREATE DATABASE kaamelott;
- Query OK, 1 row affected (0,00 sec)
- mysql> USE kaamelott;
- Database changed
- mysql> CREATE TABLE `knight`(
- -> `id`INT PRIMARY KEY AUTO_INCREMENT,
- -> `name`VARCHAR(80),
- -> `age` INT);
- Query OK, 0 rows affected (0,00 sec)
- mysql> DESCRIBE knight;
- +-------+-------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +-------+-------------+------+-----+---------+----------------+
- | id | int(11) | NO | PRI | NULL | auto_increment |
- | name | varchar(80) | YES | | NULL | |
- | age | int(11) | YES | | NULL | |
- +-------+-------------+------+-----+---------+----------------+
- 3 rows in set (0,00 sec)
- mysql> INSERT INTO knight (name, age) VALUES ("Arthur", 40) ("perceval", 35) ("Lancelot", 38);
- 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 '("perceval", 35) ("Lancelot", 38)' at line 1
- mysql> INSERT INTO knight (name, age) VALUES ("Arthur", 40) ("Perceval", 35) ("Lancelot", 38);
- 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 '("Perceval", 35) ("Lancelot", 38)' at line 1
- mysql> INSERT INTO knight (name, age) VALUES ("Arthur", 40), ("Perceval", 35), ("Lancelot", 38);
- Query OK, 3 rows affected (0,00 sec)
- Records: 3 Duplicates: 0 Warnings: 0
- mysql> DESCRIBE knight;
- +-------+-------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +-------+-------------+------+-----+---------+----------------+
- | id | int(11) | NO | PRI | NULL | auto_increment |
- | name | varchar(80) | YES | | NULL | |
- | age | int(11) | YES | | NULL | |
- +-------+-------------+------+-----+---------+----------------+
- 3 rows in set (0,00 sec)
- mysql> SELECT name FROM knight;
- +----------+
- | name |
- +----------+
- | Arthur |
- | Perceval |
- | Lancelot |
- +----------+
- 3 rows in set (0,00 sec)
- mysql> UPDATE knight SET age=36 WHERE name="Perceval";
- Query OK, 1 row affected (0,00 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> SELECT age FROM knight;
- +------+
- | age |
- +------+
- | 40 |
- | 36 |
- | 38 |
- +------+
- 3 rows in set (0,00 sec)
- mysql> DELETE FROM knight WHERE name="Lancelot";
- Query OK, 1 row affected (0,00 sec)
- mysql> SELECT name FROM knight;
- +----------+
- | name |
- +----------+
- | Arthur |
- | Perceval |
- +----------+
- 2 rows in set (0,00 sec)
- mysql> \quit
- Bye
- ➜ ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement