学Java-图书销售系统-数据库结构
时间:2011-03-12 csdn博客 老紫竹
/*
MySQL Data Transfer
Source Host: localhost
Source Database: book
Target Host: localhost
Target Database: book
Date: 2008-7-25 13:55:48
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for t_book
-- ----------------------------
CREATE TABLE `t_book` (
`id` int(11) NOT NULL auto_increment COMMENT ''流水号'',
`name` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT ''书名'',
`price` decimal(10,2) NOT NULL COMMENT ''价格'',
`quantity` int(11) NOT NULL COMMENT ''数量'',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Table structure for t_bookstockhistory
-- ----------------------------
CREATE TABLE `t_bookstockhistory` (
`id` int(11) NOT NULL auto_increment COMMENT ''流水号'',
`bookId` int(11) NOT NULL COMMENT ''图书编号'',
`quantity` int(11) NOT NULL COMMENT ''数量'',
`quantityOutstanding` int(11) NOT NULL COMMENT ''数量结存'',
`price` decimal(10,2) NOT NULL COMMENT ''价格'',
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT ''时间'',
`note` varchar(255) collate utf8_unicode_ci default NULL COMMENT ''备注'',
PRIMARY KEY (`id`),
KEY `bookId` (`bookId`),
CONSTRAINT `t_bookstockhistory_ibfk_1` FOREIGN KEY (`bookId`) REFERENCES `t_book` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Table structure for t_order
-- ----------------------------
CREATE TABLE `t_order` (
`id` int(11) NOT NULL auto_increment COMMENT ''流水号'',
`UserId` int(11) NOT NULL COMMENT ''会员编号'',
`Amount` decimal(10,0) NOT NULL COMMENT ''总金额'',
`Datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT ''时间'',
`Note` varchar(200) collate utf8_unicode_ci default NULL COMMENT ''备注'',
PRIMARY KEY (`id`),
KEY `UserId` (`UserId`),
CONSTRAINT `t_order_ibfk_1` FOREIGN KEY (`UserId`) REFERENCES `t_user` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Table structure for t_orderbook
-- ----------------------------
CREATE TABLE `t_orderbook` (
`Id` int(11) NOT NULL auto_increment COMMENT ''流水号'',
`OrderId` int(11) NOT NULL COMMENT ''订单号'',
`BookId` int(11) NOT NULL COMMENT ''图书编号'',
`Quantity` int(11) NOT NULL COMMENT ''数量'',
PRIMARY KEY (`Id`),
KEY `OrderId` (`OrderId`),
KEY `BookId` (`BookId`),
CONSTRAINT `t_orderbook_ibfk_1` FOREIGN KEY (`OrderId`) REFERENCES `t_order` (`id`),
CONSTRAINT `t_orderbook_ibfk_2` FOREIGN KEY (`BookId`) REFERENCES `t_book` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Table structure for t_user
-- ----------------------------
CREATE TABLE `t_user` (
`Id`
|