MySQL allows you to insert one or more tuples into a table that already exists.
Format:INSERT into table name (property name 1, property name 2, property name 3) VALUES (VALUE1,VALUE2,VALUE3);
INSERT into table name (property name 1, property name 2, property name 3) VALUES (value-a1,value-a2,value-a3), (value-b1,value-b2,value-b3);
Note: If the value value is a character type, you need to enclose the double quotation mark ""
1. Insert by tuple
1) first create a table
mysql> use testdatabase changedmysql> CREATE TABLE courses int auto_increment PRIMARY key,< c4/>Char() not NULL, char( 0 ) rows affected (0.07 sec)
2) and insert the tuple
INSERT INTO courses (Name,submission_date) VALUES ("Math", now ()); INSERT INTO courses (Name,submission_date) VALUES ("Language", now ()); INSERT INTO courses (Name,submission_date) VALUES ("English", Now ()); Query OK, 1 row affected, 1 warning (0.06 sec) mysql> insert INTO courses (Name,submission_date) VALUES ("Chemistry", now ()); INSERT INTO courses (Name,submission_date) VALUES ("History", now ()); Query OK, 1 row affected, 1 warning (0.01 sec)
Where the value of the property num is not set because its value is automatically incremented.
3) meta-group view
Mysql> SELECT * FROM courses;+-----+--------+-----------------+| num | Name | submission_date |+-----+--------+-----------------+| 1 | Math | 2018-01-30 | | 2 | language | 2018-01-30 | | 3 | English | 2018-01-30 | | 4 | Chemistry | 2018-01-30 | | 5 | History | 2018-01-30 |+-----+--------+-----------------+5 rows in Set (0.00 sec)
2. Multiple meta-groups inserted
INSERT INTO courses (Name,submission_date) VALUES ("Mobs", now ()), (" politics", Now ()), ("Sport", now ()); Query OK, 3 rows affected, 3 warnings (0.03 sec) records:3 duplicates:0 warnings:3mysql> select * FROM Course s;+-----+--------+-----------------+| num | Name | submission_date |+-----+--------+-----------------+| 1 | Math | 2018-01-30 | | 2 | language | 2018-01-30 | | 3 | English | 2018-01-30 | | 4 | Chemistry | 2018-01-30 | | 5 | History | 2018-01-30 | | 6 | Biology | 2018-01-30 | | 7 | Politics | 2018-01-30 | | 8 | Sports | 2018-01-30 |+-----+--------+-----------------+8 rows in Set (0.00 sec)
MySQL Insert Command