-- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- 主機: 127.0.0.1
-- 產生時間： 2015-09-21 02:03:45
-- 伺服器版本: 5.6.26
-- PHP 版本： 5.6.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- 資料庫： `library`
--
CREATE DATABASE IF NOT EXISTS `library` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `library`;

-- --------------------------------------------------------

--
-- 資料表結構 `author`
--

DROP TABLE IF EXISTS `author`;
CREATE TABLE IF NOT EXISTS `author` (
  `AuthorID` int(2) NOT NULL,
  `AuthorName` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `AuthorGender` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `Nationality` varchar(4) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;

--
-- 資料表的匯出資料 `author`
--

INSERT INTO `author` (`AuthorID`, `AuthorName`, `AuthorGender`, `Nationality`) VALUES
(1, '吳權威', 'M', 'ROC'),
(2, '羅毅志', 'M', 'ROC'),
(3, '達列', 'M', 'CAN'),
(4, '林邦傑', 'M', 'ROC'),
(5, '李志文', 'M', 'ROC'),
(6, '昱得', 'M', 'USA'),
(7, '溫惠美', 'F', 'ROC'),
(8, 'Beighley, Lynn', 'M', 'USA'),
(9, 'Nixon, Robin', 'M', 'USA'),
(10, 'Marty Matthews', 'M', 'USA'),
(11, '尼克森', 'M', 'AUS'),
(12, '凱文瑞克', 'M', 'USA'),
(13, '愛得曼', 'F', 'USA'),
(14, '陳俊宏', 'M', 'ROC');

-- --------------------------------------------------------

--
-- 資料表結構 `book`
--

DROP TABLE IF EXISTS `book`;
CREATE TABLE IF NOT EXISTS `book` (
  `BookID` varchar(6) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `BookName` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `AuthorID` int(2) DEFAULT NULL,
  `ISBN` varchar(12) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `Company` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `Borrow` int(2) DEFAULT NULL,
  `Click` int(2) DEFAULT NULL,
  `Picture` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- 資料表的匯出資料 `book`
--

INSERT INTO `book` (`BookID`, `BookName`, `AuthorID`, `ISBN`, `Company`, `Borrow`, `Click`, `Picture`) VALUES
('112202', 'PHP & MySQL 4徹底研究 : Web資料庫設計', 14, '9577178545', '臺北市 : 旗標, 民91', 17, 7, '112202.jpg'),
('123920', 'ASP.NET動態網頁入門與應用', 1, '9864213083', '臺北市 : 碁峰資訊, 2003[民92]', 19, 5, '123920.jpg'),
('127964', 'PHP與MySQL入門學習指南', 12, '9577179991', '臺北市 : 旗標, 民92', 13, 3, '127964.jpg'),
('132138', 'Access 2003中文版實務', 1, '9864214608', '臺北市 : 碁峰資訊, 民92', 14, 8, '132138.jpg'),
('147949', 'Fedora Core 2 Linux入門與架站實務', 1, '9867485440', '臺北市 : 網奕資訊科技, 民93', 5, 2, '147949.jpg'),
('154924', '12小時學會PHP5+MySQL互動式網頁設計', 2, '9861254064', '臺北市 : 文魁資訊, 民93', 42, 50, '154924.jpg'),
('159452', '視覺化PHP與MySQL快速學習指南', 13, '9574421910', '臺北市 : 旗標, 2004[民93]', 23, 4, '159452.jpg'),
('200645', 'Dreamweaver 8 & PHP網頁資料庫', 5, '9574423182', '臺北市 : 旗標, 2005[民94]', 28, 1, '200645.jpg'),
('213365', 'Dreamweaver 8 for JSP與MySQL動態資料庫網頁', 7, '9861492022', '臺北市 : 金禾資訊, 2006[民95]', 22, 4, '213365.jpg'),
('234798', 'Dreamweaver CS3資料庫實例應用 : 使用PHP', 6, '9789574422', '臺北市 : 旗標, 2007[民96]', 23, 1, '234798.jpg'),
('234809', 'Dreamweaver CS3與PHP網頁設計實務', 1, '9789866879', '臺北市 : 網奕資訊科技, 2008[民97]', 20, 1, '234809.jpg'),
('235767', '深入淺出SQL', 8, '9789866840', '臺北市 : 歐萊禮, 2008[民97]', 35, 15, '235767.jpg'),
('249355', 'AJAX & PHP : Web2.0網站開發手札', 3, '9867199847', '臺北市 : 上奇科技, 2006[民95]', 11, 6, '249355.jpg'),
('262465', 'AJAX+PHP實務應用', 4, '9789862042', '臺北市 : 文魁資訊, 2008[民97]', 14, 2, '262465.jpg'),
('351021', 'Head first PHP & MySQL', 8, '9780596006', 'Beijing ; O''Reilly, 2009 ', 25, 3, '351021.jpg'),
('364232', 'PHP, MySQL, JavaScript與CSS學習手冊', 11, '9789862766', '臺北市 : 碁?資訊, 2013[民102]', 19, 13, '364232.jpg'),
('411164', 'Learning PHP, MySQL & JavaScript', 9, '9781491918', 'Beijing ; O''Reilly, 2009 ', 2, 1, '411164.jpg'),
('412542', 'PHP and MySQL Web Development', 10, '9780071837', 'McGraw-Hill Education 2014-01-01', 20, 5, '412542.jpg');

-- --------------------------------------------------------

--
-- 資料表結構 `reader`
--

DROP TABLE IF EXISTS `reader`;
CREATE TABLE IF NOT EXISTS `reader` (
  `ReaderID` int(4) NOT NULL DEFAULT '0',
  `ReaderName` varchar(6) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `ReaderGender` char(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- 資料表的匯出資料 `reader`
--

INSERT INTO `reader` (`ReaderID`, `ReaderName`, `ReaderGender`) VALUES
(2135, '陳一生', '男'),
(3148, '柯曉陵', '女'),
(3411, '何大志', '男'),
(4586, '楊吉祥', '男'),
(5862, '蘇多緣', '男'),
(7311, '張忠偉', '男');

-- --------------------------------------------------------

--
-- 資料表結構 `status`
--

DROP TABLE IF EXISTS `status`;
CREATE TABLE IF NOT EXISTS `status` (
  `Barcode` varchar(8) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `BookID` varchar(6) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `BookIndex` varchar(28) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `Classify` varchar(8) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `ReturnDate` date DEFAULT NULL,
  `ReaderID` int(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- 資料表的匯出資料 `status`
--

INSERT INTO `status` (`Barcode`, `BookID`, `BookIndex`, `Classify`, `ReturnDate`, `ReaderID`) VALUES
('1159114', '112202', '312.9754 8792-2 91', '中文圖書', '2015-09-12', 2135),
('1159115', '112202', '312.9754 8792-2 91 c.2', '中文圖書', '2015-09-04', 3148),
('1166799', '112202', '312.9754 8792-2 2002 c.3', '中文圖書', '2015-11-07', 7311),
('1168741', '123920', '312.91695 8843 2003', '中文圖書', '2015-11-16', 3411),
('1170310', '123920', '312.91695 8843 2003 c.2', '中文圖書', '2015-09-18', 2135),
('1173328', '127964', '312.974 8565 2003', '中文圖書', '2015-11-09', 2135),
('1176866', '132138', '312.949A42 8843-3 2003', '中文圖書', '2015-08-13', 5862),
('1184366', '147949', '312.954 8843-3 2004', '中文圖書', '2015-07-03', 3411),
('1193472', '159452', '312.9754 8958 2004', '中文圖書', '2015-09-17', 3411),
('1196231', '154924', '312.9754 8563 2004', '中文圖書', '2015-04-15', 5862),
('1227024', '200645', '312.91695 8436 2005', '中文圖書', '2015-07-07', 2135),
('1237771', '213365', '312.91695 8336 2006', '中文圖書', '2015-10-28', 5862),
('1259858', '234798', '312.91695 8552 2007', '中文圖書', '2015-03-21', 2135),
('1259866', '234809', '312.1695 8843 2008', '中文圖書', '2015-09-09', 2135),
('1261290', '235767', '312.97565 8444 2007', '中文圖書', '2015-10-25', 7311),
('1266861', '249355', '312.1695 875 2006', '中文圖書', '2015-07-11', 2135),
('1270699', '262465', '312.1695 8779 2008', '中文圖書', '2015-04-18', 5862),
('1305043', '364232', '312.754 8557:2 2013', '中文圖書', '2015-09-14', 5862),
('2015718', '411164', '312.97565 8444 2015', '西文圖書', '2015-09-03', 3148),
('2015828', '412542', '412.97565 8444 2015', '西文圖書', '2015-10-13', 2135),
('2108217', '351021', '006.76 B422 2009', '西文圖書', '2015-09-15', 4586);

--
-- 資料表結構 `user`
-- added by khyang 20151012.

DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
    `UserID` INT(5) NOT NULL AUTO_INCREMENT , 
	`UserName` VARCHAR(30) NOT NULL , 
	PRIMARY KEY (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;




--
-- 已匯出資料表的索引
--

--
-- 資料表索引 `author`
--
ALTER TABLE `author`
  ADD PRIMARY KEY (`AuthorID`),
  ADD UNIQUE KEY `AuthorID` (`AuthorID`);

--
-- 資料表索引 `book`
--
ALTER TABLE `book`
  ADD PRIMARY KEY (`BookID`);

--
-- 資料表索引 `reader`
--
ALTER TABLE `reader`
  ADD PRIMARY KEY (`ReaderID`);

--
-- 資料表索引 `status`
--
ALTER TABLE `status`
  ADD PRIMARY KEY (`Barcode`);

--
-- 在匯出的資料表使用 AUTO_INCREMENT
--

--
-- 使用資料表 AUTO_INCREMENT `author`
--
ALTER TABLE `author`
  MODIFY `AuthorID` int(2) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=15;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
