/*
 Navicat Premium Data Transfer

 Source Server         : JDBC
 Source Server Type    : MySQL
 Source Server Version : 80027
 Source Host           : localhost:3306
 Source Schema         : library

 Target Server Type    : MySQL
 Target Server Version : 80027
 File Encoding         : 65001

 Date: 25/05/2024 17:43:04
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for book
-- ----------------------------
DROP TABLE IF EXISTS `book`;
CREATE TABLE `book`  (
  `bnum` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `bclass` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `bname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `publisher` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `year` int(0) NULL DEFAULT NULL,
  `author` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `price` decimal(7, 2) NULL DEFAULT NULL,
  `total` int(0) NULL DEFAULT NULL,
  `collection` int(0) NULL DEFAULT NULL,
  PRIMARY KEY (`bnum`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of book
-- ----------------------------
INSERT INTO `book` VALUES (' 21401202727', '计算机', 'python基础', '长春出版社', 2021, '李四', 500.00, 49, 3);
INSERT INTO `book` VALUES ('1', '1', '1', '1', 1, '1', 1.00, 49, 1);
INSERT INTO `book` VALUES ('111', '卷心菜', 'python入门到精通', '工信出版社', 2022, '小白', 54.00, 49, 0);
INSERT INTO `book` VALUES ('21401202727', '计算机', 'python基础', '长春出版社', 2022, '张三', 50.00, 49, 1);
INSERT INTO `book` VALUES ('book_no_1', 'Computer Science', '《计算机网络自顶向下方法》', '机械工业出版社', 2018, '詹姆斯', 89.00, 49, 3);
INSERT INTO `book` VALUES ('book_no_10', '外国名著', '《老人与海》', '延边人民出版社', 2000, '海明威', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_11', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_12', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_13', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_14', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_15', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_16', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_17', 'Computer Science', '《Computer Architecture》', 'xxx', 2003, 'xxx', 90.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_2', 'Computer Science', '《深入理解计算机系统》', '机械工业出版社', 2016, '兰德尔', 139.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_3', 'Computer Science', '《图解HTTP》', '人民邮电出版社', 2014, '上野宣', 49.00, 49, 5);
INSERT INTO `book` VALUES ('book_no_4', '青春小说', '《余生，请多指教》', '百花洲文艺出版社', 2016, '柏林石匠', 32.00, 49, 1);
INSERT INTO `book` VALUES ('book_no_5', 'Computer Science', '《AI传奇，人工智能通俗史》', '机械工业出版社', 2017, '陈宗周', 59.00, 49, 6);
INSERT INTO `book` VALUES ('book_no_6', '青春小说', '《致我们单纯的小美好 上+下》', '江苏凤凰文艺出版社', 2015, '赵乾乾', 48.00, 49, 4);
INSERT INTO `book` VALUES ('book_no_7', '文学', '《津轻》', '四川文艺出版社', 2017, '太宰治', 39.80, 49, 2);
INSERT INTO `book` VALUES ('book_no_8', '外国名著', '《人间失格》', '浙江文艺出版社', 2016, '太宰治', 25.00, 49, 2);
INSERT INTO `book` VALUES ('book_no_9', '文学', '《追风筝的人》', '上海人民出版社', 2006, '卡勒德', 29.00, 49, 2);

-- ----------------------------
-- Table structure for borrow
-- ----------------------------
DROP TABLE IF EXISTS `borrow`;
CREATE TABLE `borrow`  (
  `cnum` char(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `bnum` char(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `btime` datetime(0) NULL DEFAULT NULL,
  `rtime` datetime(0) NULL DEFAULT NULL,
  `times` int(0) NULL DEFAULT NULL,
  PRIMARY KEY (`cnum`, `bnum`) USING BTREE,
  INDEX `bnum`(`bnum`) USING BTREE,
  CONSTRAINT `borrow_ibfk_1` FOREIGN KEY (`cnum`) REFERENCES `card` (`cnum`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `borrow_ibfk_2` FOREIGN KEY (`bnum`) REFERENCES `book` (`bnum`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of borrow
-- ----------------------------
INSERT INTO `borrow` VALUES ('1231231', '111', '2024-05-20 19:07:24', '2024-05-27 19:07:24', 1);

-- ----------------------------
-- Table structure for card
-- ----------------------------
DROP TABLE IF EXISTS `card`;
CREATE TABLE `card`  (
  `cnum` char(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `department` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `numbers` int(0) NULL DEFAULT NULL,
  PRIMARY KEY (`cnum`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of card
-- ----------------------------
INSERT INTO `card` VALUES ('1231231', '试试', '计算机', 'T', 1);
INSERT INTO `card` VALUES ('1234567', '小白', '信息工程', 'S', 0);

SET FOREIGN_KEY_CHECKS = 1;
