插入记录
book表结构:
mysql> describe book;
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| book_id | int | NO | PRI | NULL | |
| title | varchar(128) | YES | | NULL | |
| description | varchar(512) | YES | | NULL | |
| published | date | YES | | NULL | |
| author_id | int | YES | MUL | NULL | |
| price | float | YES | | NULL | |
| rating | int | YES | | NULL | |
+-------------+--------------+------+-----+---------+-------+
author表结构:
mysql> describe author;
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| author_id | int | NO | PRI | NULL | |
| name | varchar(45) | YES | | NULL | |
| email | varchar(45) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
插入author表单条记录:
insert into author values(10,'Cay Horstmann','horstmann@gmail.com');
插入author表多条记录:
insert into author values
(11,'Dane Cameron','cameron@gmail.com'),
(12,'Richard Warbuton','richard@gmail.com'),
(13,'Bruce Eckel','bruce@gmail.com'),
(14,'Joshua Bloch','bloch@gmail.com');
插入book表多条记录:
insert into book values(8,'Effective java','core java Best practices',20080508,14,33.63,4),
(9,'Java SE 8 for Really impatient','Master java8',20140124,10,37,4),
(10,'Java 8:The fundamentals','Learn the fundamentals of java8',20140315,11,28,4),
(11,'java 8 Lambdas','mastering pragmatic functional programming',20140417,12,32,4),
(12,'java Puzzlers','java Traps,Pitfals,and Comer cases',20050704,14,40.2,5),
(13,'Core java for the Impatient','Masting Core java',20150212,10,35.96,3),
(14,'Object-Oriented Design and Patterns','Mastering OOP design',20050602,10,122.35,4),
(15,'Thinging in C++','Mastering C++',20000325,13,59.13,5);