Home > Java > javaTutorial > java database table structure

java database table structure

巴扎黑
Release: 2017-06-26 11:33:43
Original
2471 people have browsed it

There are only four tables in the entire project

book-book master table, which records the detailed information of the book, including category, author description, etc.

type- Category table, book category management

menu-catalog chapter table

properties-configuration table

book table Is the main book table

code: used for book code records. This field can be considered to determine the uniqueness of the book

typeId: associated type table primary key id, identifying the book category

title :Book title

author:author

lastMenuId: latest chapter directory, associated menu table primary key id

description: book description

originalUrl (obsolete)

imageUri: Image address, this address is a relative address. The file name of the book display image is recorded

createTime: book entry time

updateTime: last update time

rootTypeId: main category id, tpye table primary key id, see type for details Table record

menuNum: Number of book catalogs

textSize: How many words are there in the current book

menu chapter table :

description: Chapter name

prevMenuId: previous chapter id (menu table primary key id)

nextMenuId: next chapter id (menu table primary key id)

bookId: book id (book table primary key id)

contentUri: text address (this address is the address where the text file is stored on the server)

createTime: chapter entry time

code: Chapter coding (no specific effect)

mversion: Chapter version control (to prevent repeated entry)

## The #type table is the book category table:

description: category description

level: category level

parentId: the parent category it belongs to

Category establishment As mentioned above, the main category with level 1 is the main category, and the level below it with level 2 is the subcategory. The parentId of the subcategory is associated with the primary key id of the parent category. The main category has no parent category, that is, the parentId is 0

One thing to mention here is that the parent class primary key * 100 is incremented as the primary key id of the subcategory. For example, the parent category with id 101 has an id 1

. The properties table is used for configuration. Consider placing the configuration in the program in properties in the next version.

Now this table only has one configuration

pKey: Read the corresponding pValue value for the program and display it as a marquee on the homepage

The table creation script is given here for your reference:

<br/>
Copy after login
ET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for book-- ----------------------------DROP TABLE IF EXISTS `book`;CREATE TABLE `book` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT &#39;图书主表&#39;,
  `code` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;图书编码(默认图书目录地址,也是图书文件保留目录)&#39;,
  `typeId` int(11) DEFAULT NULL COMMENT &#39;类别&#39;,
  `title` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;书名&#39;,
  `author` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;作者&#39;,
  `lastMenuId` int(11) DEFAULT &#39;0&#39; COMMENT &#39;最新章节目录Id&#39;,
  `description` varchar(500) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;简介描述&#39;,
  `originalUrl` varchar(200) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;已废弃&#39;,
  `imageUri` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;图片地址&#39;,
  `createTime` timestamp NULL DEFAULT NULL COMMENT &#39;创建时间&#39;,
  `updateTime` timestamp NULL DEFAULT NULL COMMENT &#39;更新时间&#39;,
  `rootTypeId` int(11) DEFAULT NULL COMMENT &#39;主类别&#39;,
  `menuNum` int(11) DEFAULT &#39;0&#39; COMMENT &#39;章节总数&#39;,
  `textSize` bigint(18) DEFAULT &#39;0&#39; COMMENT &#39;小说字数&#39;,  PRIMARY KEY (`id`),  UNIQUE KEY `index_title` (`code`) USING BTREE,  KEY `FK_mxn08ipa84r1evyt2cnn7jkpi` (`typeId`,`rootTypeId`),  KEY `FK_6ji3nbliycexuj771dlqn25s3` (`lastMenuId`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;-- ------------------------------ Table structure for menu-- ----------------------------DROP TABLE IF EXISTS `menu`;CREATE TABLE `menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;描述&#39;,
  `prevMenuId` int(11) DEFAULT &#39;0&#39; COMMENT &#39;上一章id&#39;,
  `nextMenuId` int(11) DEFAULT &#39;0&#39; COMMENT &#39;下一章id&#39;,
  `bookId` int(11) DEFAULT NULL COMMENT &#39;图书id&#39;,
  `contentUri` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;文本路径&#39;,
  `createTime` timestamp NULL DEFAULT NULL COMMENT &#39;创建时间&#39;,
  `code` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;编码(做索引)&#39;,
  `mversion` varchar(45) COLLATE utf8_bin DEFAULT NULL,  PRIMARY KEY (`id`),  UNIQUE KEY `mvserion` (`mversion`) USING BTREE,  KEY `FK_c6rhyxr26doitte59912cid6v` (`bookId`),  CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`bookId`) REFERENCES `book` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=231 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;-- ------------------------------ Table structure for properties-- ----------------------------DROP TABLE IF EXISTS `properties`;CREATE TABLE `properties` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pKey` varchar(45) COLLATE utf8_bin NOT NULL,
  `pValue` varchar(256) COLLATE utf8_bin NOT NULL,
  `description` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;描述&#39;,  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;-- ------------------------------ Table structure for type-- ----------------------------DROP TABLE IF EXISTS `type`;CREATE TABLE `type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT &#39;类别描述&#39;,
  `level` int(11) DEFAULT NULL COMMENT &#39;类别等级&#39;,
  `parentId` int(11) unsigned DEFAULT &#39;0&#39; COMMENT &#39;父类别&#39;,  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=702 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Copy after login

The above is the detailed content of java database table structure. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template