-- https://www.phpmyadmin.net/
--
-- 主機： localhost:3306
-- 產生時間： 2024 年 05 月 06 日 20:57
-- 伺服器版本： 8.0.36-0ubuntu0.20.04.1
-- PHP 版本： 8.2.14

START TRANSACTION;



--
-- 資料庫： `goat`
--

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

--
-- 資料表結構 `childbirth`
--

CREATE TABLE `childbirth` (
  `Cid` int NOT NULL,
  `mating` date DEFAULT NULL,
  `examine` date DEFAULT NULL,
  `Pregnant` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `num` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `childbirth` date DEFAULT NULL,
  `gid` int NOT NULL,
  `mid` int NOT NULL,
  `confirm` int DEFAULT NULL,
  `out` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- 傾印資料表的資料 `childbirth`
--

INSERT INTO `childbirth` (`Cid`, `mating`, `examine`, `Pregnant`, `num`, `childbirth`, `gid`, `mid`, `confirm`, `out`) VALUES
(12, '2023-12-18', '2023-12-19', 'yes', '3', '2023-12-29', 25, 1, 1, 0),
(13, '2024-01-01', '2024-01-01', 'yes', '1', '2024-01-07', 21, 1, 1, 0),
(14, '2023-12-22', '2023-12-22', 'yes', '3', '2023-12-30', 28, 1, 1, 0),
(15, '2024-01-01', '2024-01-01', 'yes', '2', '2024-01-09', 27, 1, 1, 0),
(16, '2024-01-11', '2024-01-11', 'yes', '1', '2024-01-19', 169, 1, 0, 0),
(17, '2024-01-14', '2024-01-14', 'yes', '1', '2024-01-22', 22, 1, 0, 0),
(18, '2024-04-12', '2024-04-12', 'yes', '2', '2024-08-27', 21, 6, 0, 0);

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

--
-- 資料表結構 `disease`
--

CREATE TABLE `disease` (
  `did` int NOT NULL,
  `gid` int DEFAULT NULL,
  `date` date DEFAULT NULL,
  `diseasetype` varchar(50) DEFAULT NULL,
  `drugname` varchar(50) DEFAULT NULL,
  `remark` varchar(255) DEFAULT NULL,
  `mid` int NOT NULL,
  `Smedication` date NOT NULL,
  `confirm` int DEFAULT NULL,
  `add_time` date DEFAULT NULL,
  `out` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `disease`
--

INSERT INTO `disease` (`did`, `gid`, `date`, `diseasetype`, `drugname`, `remark`, `mid`, `Smedication`, `confirm`, `add_time`, `out`) VALUES
(12, 21, '2023-12-17', '乳房炎', '新萬靈素軟膏', '無', 1, '2023-12-31', 1, '2023-12-18', 0),
(13, 21, '2024-01-09', '腸胃炎', '新萬靈素軟膏', '無', 1, '2024-01-23', 1, '2024-01-06', 0),
(14, 161, '2024-01-02', '腸胃炎', 'Povidone lodine 2%', '無', 1, '2024-01-16', 1, '2024-01-13', 0),
(15, 31, '2024-01-08', '放射菌感染病', '泌乳樂(CEROXIM OINTMENT)', '無', 1, '2024-01-22', 1, '2024-01-13', 1),
(16, 32, '2024-01-07', '肺炎', 'Povidone lodine 2%', '無', 1, '2024-01-30', 0, '2024-01-13', 0),
(17, 28, '2023-12-06', '放射菌感染病', '新萬靈素軟膏', '無', 1, '2023-12-20', 1, '2024-01-13', 0),
(18, 27, '2024-01-04', '腦炎', '泌乳樂(CEROXIM OINTMENT)', '無', 1, '2024-01-18', 0, '2024-01-13', 0),
(19, 162, '2023-12-12', '氣管炎', '長效72', '無', 1, '2023-12-26', 0, '2024-01-13', 0),
(20, 169, '2024-01-14', '氣管炎', '長效72', '無', 1, '2024-01-28', 0, '2024-01-13', 0),
(21, 25, '2024-04-15', '腸胃炎', 'Povidone lodine 2%', '無', 1, '2024-04-29', 0, '2024-01-16', 0);

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

--
-- 資料表結構 `disease_type`
--

CREATE TABLE `disease_type` (
  `sn` int NOT NULL,
  `type` varchar(50) DEFAULT NULL,
  `drugname` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `disease_type`
--

INSERT INTO `disease_type` (`sn`, `type`, `drugname`) VALUES
(1, '腸胃炎', '新萬靈素軟膏'),
(2, '腦炎', '喜福安乾乳軟膏'),
(3, '氣管炎', '泌乳樂(CEROXIM OINTMENT)'),
(4, '', 'Povidone lodine 2%'),
(5, '', '長效72'),
(6, '', 'Oxytetracycline 20%'),
(7, '', '克被寧LC(C0bactan LC)'),
(8, '', '拜有利10%注射液'),
(9, '', '碩騰保久靈(TERRAMICINA/LA COLUCAO INJETVEL)');

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

--
-- 資料表結構 `drecords`
--

CREATE TABLE `drecords` (
  `Did` int NOT NULL,
  `Dunit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `date` date NOT NULL,
  `Dcolumn` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `Dwater` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `factor` float NOT NULL,
  `Dname` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `mid` int NOT NULL,
  `Dcolumn2` varchar(50) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- 傾印資料表的資料 `drecords`
--

INSERT INTO `drecords` (`Did`, `Dunit`, `date`, `Dcolumn`, `Dwater`, `factor`, `Dname`, `mid`, `Dcolumn2`) VALUES
(15, '佳美居牧場', '2023-08-05', 'A', '碘液', 20, '羊場人員', 1, 'E'),
(26, '佳美居牧場', '2024-01-05', 'A', '衛可', 10, '羊場人員', 1, 'B'),
(29, '佳美居牧場', '2024-01-09', 'A', '碘液', 10, '羊場人員', 1, 'D'),
(30, '佳美居牧場', '2024-01-10', 'C', '衛可', 10, '羊場人員', 1, 'B'),
(31, '佳美居牧場', '2024-01-15', 'A', '碘液', 10, '羊場人員', 1, 'E');

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

--
-- 資料表結構 `feed`
--

CREATE TABLE `feed` (
  `fid` int NOT NULL,
  `fdate` date NOT NULL,
  `ftime` time NOT NULL,
  `fine` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `coarse` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `element` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `proportion` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `creep` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `mid` int NOT NULL,
  `column` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `district` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `foodweight` int DEFAULT NULL,
  `goatquantity` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- 傾印資料表的資料 `feed`
--

INSERT INTO `feed` (`fid`, `fdate`, `ftime`, `fine`, `coarse`, `element`, `proportion`, `creep`, `mid`, `column`, `district`, `foodweight`, `goatquantity`) VALUES
(87, '2024-05-03', '02:59:00', '蘿蔔簽', '乾草', '蛋白質', '5:5', '無', 1, 'A4', 'A', 50, 20),
(88, '2024-05-04', '13:44:00', '蘿蔔簽', '青貯', '蛋白質、水', '5:5', '無', 1, 'A4', 'A', 50, 50),
(89, '2024-05-04', '05:54:00', '豆粉', '乾草', '蛋白質、水', '5:5', '無', 1, 'A4', 'A', 50, 20);

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

--
-- 資料表結構 `food`
--

CREATE TABLE `food` (
  `n` int NOT NULL,
  `fine` varchar(50) DEFAULT NULL,
  `coarse` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `food`
--

INSERT INTO `food` (`n`, `fine`, `coarse`) VALUES
(1, '豆粉', '青貯'),
(2, NULL, '乾草'),
(10, '蘿蔔簽', NULL),
(11, NULL, '桑葉');

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

--
-- 資料表結構 `gcolumn`
--

CREATE TABLE `gcolumn` (
  `cid` int NOT NULL,
  `name` varchar(50) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `gcolumn`
--

INSERT INTO `gcolumn` (`cid`, `name`, `type`) VALUES
(1, 'A1', 'A'),
(2, 'A2', 'A'),
(3, 'B1', 'B'),
(4, 'B2', 'B'),
(5, 'C1', 'C'),
(6, 'C2', 'C'),
(7, 'D1', 'D'),
(8, 'D2', 'D'),
(9, 'E1', 'E'),
(10, 'E2', 'E'),
(11, 'A3', 'A'),
(12, 'A4', 'A'),
(13, 'A5', 'A'),
(14, 'A6', 'A'),
(15, 'A7', 'A'),
(16, 'A8', 'A'),
(17, 'B3', 'B'),
(18, 'B4', 'B'),
(19, 'B5', 'B'),
(20, 'B6', 'B'),
(21, 'B7', 'B'),
(22, 'C3', 'C'),
(23, 'C4', 'C'),
(24, 'D3', 'D'),
(25, 'D4', 'D'),
(26, 'E3', 'E'),
(27, 'F1', 'F'),
(28, 'F2', 'F'),
(29, 'F3', 'F');

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

--
-- 資料表結構 `gcolumn_all`
--

CREATE TABLE `gcolumn_all` (
  `cid` int NOT NULL,
  `name` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `gcolumn_all`
--

INSERT INTO `gcolumn_all` (`cid`, `name`) VALUES
(1, 'A'),
(2, 'B'),
(3, 'C'),
(4, 'D'),
(5, 'E'),
(6, 'F');

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

--
-- 資料表結構 `goatdata`
--

CREATE TABLE `goatdata` (
  `gid` int NOT NULL,
  `RFID` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
  `variety` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `gender` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `Gage` date DEFAULT NULL,
  `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `gcolumn` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `mid` int NOT NULL,
  `mating` int DEFAULT NULL,
  `source` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `add_time` date DEFAULT NULL,
  `out` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- 傾印資料表的資料 `goatdata`
--

INSERT INTO `goatdata` (`gid`, `RFID`, `variety`, `gender`, `Gage`, `unit`, `gcolumn`, `mid`, `mating`, `source`, `add_time`, `out`) VALUES
(21, 'A000003', '撒能', '母', '2024-01-09', '佳美居牧場', 'A1', 1, 2, '', '2023-12-17', 0),
(22, 'A000004', '撒能', '母', NULL, '屏科大', 'A2', 1, NULL, NULL, '2023-12-17', 0),
(23, 'A000005', '黑羊', '公', NULL, '屏科大', 'A2', 1, NULL, NULL, '2023-12-17', 0),
(24, 'A000006', '黑羊', '母', '2024-01-01', '屏科大', 'A1', 1, 0, '', '2023-12-17', 0),
(25, 'A000007', '黑羊', '母', NULL, '屏科大', 'A2', 1, 1, NULL, '2023-12-17', 0),
(27, 'A000009', '黑羊', '母', '2024-01-01', '佳美居牧場', 'A1', 1, 1, '', '2023-12-17', 0),
(28, 'A000010', '黑羊', '母', NULL, '屏科大', 'A2', 1, 1, NULL, '2023-12-17', 0),
(31, 'A000013_2024-01-21', '撒能', '母', '2024-01-15', '屏科大', 'A2', 1, 0, '', '2023-12-17', 1),
(32, 'A000014', '撒能', '公', '2024-01-01', '佳美居牧場', 'A5', 1, 0, '', '2023-12-17', 0),
(161, 'A000011', '美國', '公', NULL, '佳美居牧場', 'A1', 1, 0, NULL, '2023-12-17', 0),
(162, 'A000012', '美國', '公', '2024-01-05', '佳美居牧場', 'A3', 1, 0, '', '2023-12-17', 0),
(166, 'A000017', '美國', '公', '2023-12-12', '佳美居牧場', 'C1', 1, 0, '1', '2023-12-18', 0),
(167, 'A000001', '撒能', '公', '2023-12-14', '佳美居牧場', 'A3', 1, 0, '', '2023-12-18', 0),
(169, 'A000016', '波爾', '母', '2023-12-14', '佳美居牧場', 'A4', 1, 1, NULL, '2024-01-14', 0),
(170, 'A000018', '波爾', '公', '2024-01-11', '佳美居牧場', 'A4', 1, 0, NULL, '2024-01-14', 0),
(171, 'A000019', '努比亞', '母', '2024-01-07', '佳美居牧場', 'A5', 1, 0, NULL, '2024-01-14', 0),
(172, 'A000020', '雜交波爾', '公', '2023-12-10', '佳美居牧場', 'A6', 1, 0, NULL, '2024-01-14', 0),
(175, 'A000022', '美國', '母', '2024-02-29', '屏科大', 'A1', 11, 0, NULL, '2024-05-01', 0),
(176, 'A000021', '美國', '公', '2024-01-11', '屏科大', 'A1', 11, 0, '佳美居牧場', '2024-05-01', 0),
(177, 'A000023', '撒能', '母', '2024-01-05', '屏科大', 'A1', 11, 1, NULL, '2024-05-01', 0),
(178, 'A000024', '美國', '母', '2023-11-17', '屏科大', 'A1', 11, 1, NULL, '2024-05-01', 0),
(179, 'A000025', '撒能', '母', '2024-01-20', '屏科大', 'A1', 11, 1, NULL, '2024-05-01', 0),
(180, 'A000026', '撒能', '母', '2024-03-14', '屏科大', 'A1', 11, 2, NULL, '2024-05-01', 0),
(181, 'A000027', '撒能', '母', '2024-02-09', '屏科大', 'A1', 11, 2, NULL, '2024-05-01', 0),
(182, 'A000028', '美國', '母', '2024-03-08', '屏科大', 'A1', 11, 0, NULL, '2024-05-01', 0),
(183, 'A000029', '美國', '母', '2024-01-13', '屏科大', 'A1', 11, 0, NULL, '2024-05-01', 0),
(184, 'A000030', '撒能', '母', '2024-02-10', '屏科大', 'A1', 11, 0, NULL, '2024-05-01', 0);

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

--
-- 資料表結構 `pedigree`
--

CREATE TABLE `pedigree` (
  `gid` varchar(50) DEFAULT NULL,
  `fgoat` varchar(50) DEFAULT NULL,
  `mgoat` varchar(50) DEFAULT NULL,
  `gn` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `pedigree`
--

INSERT INTO `pedigree` (`gid`, `fgoat`, `mgoat`, `gn`) VALUES
('A000017', 'A000001', 'A000004', 2),
('A000001', 'A000003', 'A000004', 3),
('A000016', 'A000014', 'A000009', 5),
('A000018', 'A000014', 'A000004', 6),
('A000019', 'A000003', 'A000004', 7),
('A000020', 'A000011', 'A000009', 8),
('A000087', 'A000001', 'A000003', 9),
('A000021', 'A000014', 'A000009', 10),
('A000022', 'A000001', 'A000003', 11),
('A000021', 'A000001', 'A000003', 12),
('A000023', 'A000001', 'A000003', 13),
('A000024', 'A000001', 'A000003', 14),
('A000025', 'A000001', 'A000003', 15),
('A000026', 'A000001', 'A000003', 16),
('A000027', 'A000001', 'A000003', 17),
('A000028', 'A000001', 'A000003', 18),
('A000029', 'A000001', 'A000003', 19),
('A000030', 'A000001', 'A000003', 20);

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

--
-- 資料表結構 `quality`
--

CREATE TABLE `quality` (
  `qid` int NOT NULL,
  `gid` int NOT NULL DEFAULT '0',
  `diet` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `Wintake` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
  `mid` int NOT NULL,
  `out` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- 傾印資料表的資料 `quality`
--

INSERT INTO `quality` (`qid`, `gid`, `diet`, `Wintake`, `mid`, `out`) VALUES
(7, 24, '100', '100', 1, 0),
(8, 28, '100', '100', 1, 0);

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

--
-- 資料表結構 `water`
--

CREATE TABLE `water` (
  `sn` int NOT NULL,
  `water` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `water`
--

INSERT INTO `water` (`sn`, `water`) VALUES
(1, '衛可'),
(2, '碘液');

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

--
-- 資料表結構 `weight`
--

CREATE TABLE `weight` (
  `wid` int NOT NULL,
  `date` date NOT NULL,
  `gid` int NOT NULL DEFAULT '0',
  `weight` varchar(10) NOT NULL DEFAULT '',
  `mid` int NOT NULL,
  `out` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- 傾印資料表的資料 `weight`
--

INSERT INTO `weight` (`wid`, `date`, `gid`, `weight`, `mid`, `out`) VALUES
(36, '2024-03-30', 21, ' 70', 1, 0),
(37, '2024-04-30', 21, ' 75.8', 6, 0),
(39, '2024-03-30', 24, ' 71', 11, 0),
(40, '2024-04-30', 24, ' 74', 11, 0),
(42, '2024-04-01', 176, ' 72.5', 11, 0),
(43, '2024-04-01', 175, ' 68.6', 11, 0),
(44, '2024-04-01', 177, ' 75.3', 11, 0),
(45, '2024-05-13', 184, ' 77.1', 11, 0),
(46, '2024-05-06', 184, ' 69.7', 11, 0),
(47, '2024-04-29', 184, ' 70.5', 11, 0),
(48, '2024-04-22', 184, ' 72.2', 11, 0),
(49, '2024-04-15', 184, ' 75.4', 11, 0),
(50, '2024-04-08', 184, ' 66.9', 11, 0),
(51, '2024-04-01', 184, ' 74.2', 11, 0);

--
-- 已傾印資料表的索引
--

--
-- 資料表索引 `childbirth`
--
ALTER TABLE `childbirth`
  ADD PRIMARY KEY (`Cid`),
  ADD KEY `FK_childbirth_goatdata` (`gid`),
  ADD KEY `FK_childbirth_member` (`mid`);

--
-- 資料表索引 `disease`
--
ALTER TABLE `disease`
  ADD PRIMARY KEY (`did`),
  ADD KEY `FK_disease_member` (`mid`),
  ADD KEY `FK_disease_goatdata` (`gid`);

--
-- 資料表索引 `disease_type`
--
ALTER TABLE `disease_type`
  ADD PRIMARY KEY (`sn`);

--
-- 資料表索引 `drecords`
--
ALTER TABLE `drecords`
  ADD PRIMARY KEY (`Did`),
  ADD KEY `FK_drecords_member` (`mid`);

--
-- 資料表索引 `feed`
--
ALTER TABLE `feed`
  ADD PRIMARY KEY (`fid`),
  ADD KEY `FK_feed_member` (`mid`);

--
-- 資料表索引 `food`
--
ALTER TABLE `food`
  ADD PRIMARY KEY (`n`);

--
-- 資料表索引 `gcolumn`
--
ALTER TABLE `gcolumn`
  ADD PRIMARY KEY (`cid`);

--
-- 資料表索引 `gcolumn_all`
--
ALTER TABLE `gcolumn_all`
  ADD PRIMARY KEY (`cid`);

--
-- 資料表索引 `goatdata`
--
ALTER TABLE `goatdata`
  ADD PRIMARY KEY (`gid`),
  ADD KEY `FK_goatdata_member` (`mid`);

--
-- 資料表索引 `pedigree`
--
ALTER TABLE `pedigree`
  ADD PRIMARY KEY (`gn`);

--
-- 資料表索引 `quality`
--
ALTER TABLE `quality`
  ADD PRIMARY KEY (`qid`),
  ADD KEY `FK_quality_member` (`mid`),
  ADD KEY `FK_quality_goatdata` (`gid`);

--
-- 資料表索引 `water`
--
ALTER TABLE `water`
  ADD PRIMARY KEY (`sn`);

--
-- 資料表索引 `weight`
--
ALTER TABLE `weight`
  ADD PRIMARY KEY (`wid`) USING BTREE,
  ADD KEY `FK_weight_member` (`mid`),
  ADD KEY `FK_weight_goatdata` (`gid`);

--
-- 在傾印的資料表使用自動遞增(AUTO_INCREMENT)
--

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `childbirth`
--
ALTER TABLE `childbirth`
  MODIFY `Cid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `disease`
--
ALTER TABLE `disease`
  MODIFY `did` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `disease_type`
--
ALTER TABLE `disease_type`
  MODIFY `sn` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `drecords`
--
ALTER TABLE `drecords`
  MODIFY `Did` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `feed`
--
ALTER TABLE `feed`
  MODIFY `fid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=91;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `food`
--
ALTER TABLE `food`
  MODIFY `n` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `gcolumn`
--
ALTER TABLE `gcolumn`
  MODIFY `cid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `gcolumn_all`
--
ALTER TABLE `gcolumn_all`
  MODIFY `cid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `goatdata`
--
ALTER TABLE `goatdata`
  MODIFY `gid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=185;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `pedigree`
--
ALTER TABLE `pedigree`
  MODIFY `gn` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `quality`
--
ALTER TABLE `quality`
  MODIFY `qid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `water`
--
ALTER TABLE `water`
  MODIFY `sn` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- 使用資料表自動遞增(AUTO_INCREMENT) `weight`
--
ALTER TABLE `weight`
  MODIFY `wid` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;

--
-- 已傾印資料表的限制式
--

--
-- 資料表的限制式 `childbirth`
--
ALTER TABLE `childbirth`
  ADD CONSTRAINT `FK_childbirth_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  ADD CONSTRAINT `FK_childbirth_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);

--
-- 資料表的限制式 `disease`
--
ALTER TABLE `disease`
  ADD CONSTRAINT `FK_disease_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  ADD CONSTRAINT `FK_disease_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);

--
-- 資料表的限制式 `drecords`
--
ALTER TABLE `drecords`
  ADD CONSTRAINT `FK_drecords_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);

--
-- 資料表的限制式 `feed`
--
ALTER TABLE `feed`
  ADD CONSTRAINT `FK_feed_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);

--
-- 資料表的限制式 `goatdata`
--
ALTER TABLE `goatdata`
  ADD CONSTRAINT `FK_goatdata_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);

--
-- 資料表的限制式 `quality`
--
ALTER TABLE `quality`
  ADD CONSTRAINT `FK_quality_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  ADD CONSTRAINT `FK_quality_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);

--
-- 資料表的限制式 `weight`
--
ALTER TABLE `weight`
  ADD CONSTRAINT `FK_weight_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  ADD CONSTRAINT `FK_weight_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`);
COMMIT;

