在mysql中向图书借阅系统数据库中的book表插入数据,包含name,press,author,pagination,price,upload_time,status,borrower,borrow_time,return_time共十条
时间: 2023-11-10 17:06:20 浏览: 46
你可以使用以下的SQL语句向图书借阅系统数据库中的book表插入数据:
```
INSERT INTO book (name, press, author, pagination, price, upload_time, status, borrower, borrow_time, return_time)
VALUES
('Book 1', 'Press 1', 'Author 1', 100, 20.99, NOW(), 'available', NULL, NULL, NULL),
('Book 2', 'Press 2', 'Author 2', 200, 25.99, NOW(), 'available', NULL, NULL, NULL),
('Book 3', 'Press 3', 'Author 3', 150, 18.99, NOW(), 'borrowed', 'User 1', '2021-01-01', '2021-01-15'),
('Book 4', 'Press 4', 'Author 4', 300, 30.99, NOW(), 'borrowed', 'User 2', '2021-02-01', '2021-02-15'),
('Book 5', 'Press 5', 'Author 5', 250, 22.99, NOW(), 'available', NULL, NULL, NULL),
('Book 6', 'Press 6', 'Author 6', 180, 19.99, NOW(), 'borrowed', 'User 3', '2021-03-01', '2021-03-15'),
('Book 7', 'Press 7', 'Author 7', 400, 35.99, NOW(), 'available', NULL, NULL, NULL),
('Book 8', 'Press 8', 'Author 8', 220, 23.99, NOW(), 'borrowed', 'User 4', '2021-04-01', '2021-04-15'),
('Book 9', 'Press 9', 'Author 9', 150, 16.99, NOW(), 'available', NULL, NULL, NULL),
('Book 10', 'Press 10', 'Author 10', 280, 28.99, NOW(), 'borrowed', 'User 5', '2021-05-01', '2021-05-15');
```
这个SQL语句会向book表中插入10条数据,每条数据都包含了name,press,author,pagination,price,upload_time,status,borrower,borrow_time,return_time这10个字段。其中,前6个字段是必填的,后4个字段根据图书的状态来确定是否需要填写。注意,borrow_time和return_time字段需要使用日期格式'YYYY-MM-DD'来填写。