-- --------------------------------------------------------
-- 主機:                           127.0.0.1
-- 伺服器版本:                        10.5.18-MariaDB - mariadb.org binary distribution
-- 伺服器作業系統:                      Win64
-- HeidiSQL 版本:                  11.3.0.6295
-- --------------------------------------------------------



-- 傾印 goat 的資料庫結構
CREATE DATABASE IF NOT EXISTS `goat` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci */;
USE `goat`;

-- 傾印  資料表 goat.childbirth 結構
CREATE TABLE IF NOT EXISTS `childbirth` (
  `Cid` int(11) NOT NULL AUTO_INCREMENT,
  `mating` date DEFAULT NULL,
  `examine` date DEFAULT NULL,
  `Pregnant` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `num` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `childbirth` date DEFAULT NULL,
  `gid` int(11) NOT NULL,
  `mid` int(11) NOT NULL,
  `confirm` int(11) DEFAULT NULL,
  `out` int(11) DEFAULT NULL,
  PRIMARY KEY (`Cid`),
  KEY `FK_childbirth_goatdata` (`gid`),
  KEY `FK_childbirth_member` (`mid`),
  CONSTRAINT `FK_childbirth_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  CONSTRAINT `FK_childbirth_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- 正在傾印表格  goat.childbirth 的資料：~7 rows (近似值)
REPLACE 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, 0, 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);

-- 傾印  資料表 goat.disease 結構
CREATE TABLE IF NOT EXISTS `disease` (
  `did` int(11) NOT NULL AUTO_INCREMENT,
  `gid` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `diseasetype` varchar(50) DEFAULT NULL,
  `drugname` varchar(50) DEFAULT NULL,
  `remark` varchar(255) DEFAULT NULL,
  `mid` int(11) NOT NULL,
  `Smedication` date NOT NULL,
  `confirm` int(11) DEFAULT NULL,
  `add_time` date DEFAULT NULL,
  `out` int(11) DEFAULT NULL,
  PRIMARY KEY (`did`),
  KEY `FK_disease_member` (`mid`),
  KEY `FK_disease_goatdata` (`gid`),
  CONSTRAINT `FK_disease_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  CONSTRAINT `FK_disease_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.disease 的資料：~10 rows (近似值)
REPLACE 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', '氣管炎', '新感冒靈、林可黴素', '無', 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', '腸胃炎', '磺胺劑', '無', 1, '2024-01-18', 0, '2024-01-13', 0),
	(19, 162, '2023-12-12', '氣管炎', '新感冒靈、林可黴素', '無', 1, '2023-12-26', 0, '2024-01-13', 0),
	(20, 169, '2024-01-14', '氣管炎', '新感冒靈、林可黴素', '無', 1, '2024-01-28', 0, '2024-01-13', 0),
	(21, 25, '2024-04-15', '腸胃炎', '磺胺劑', '無', 1, '2024-04-29', 0, '2024-01-16', 0);

-- 傾印  資料表 goat.disease_type 結構
CREATE TABLE IF NOT EXISTS `disease_type` (
  `sn` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(50) DEFAULT NULL,
  `drugname` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`sn`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.disease_type 的資料：~9 rows (近似值)
REPLACE INTO `disease_type` (`sn`, `type`, `drugname`) VALUES
	(1, '腸胃炎', '磺胺劑'),
	(2, '氣管炎', '新感冒靈、林可黴素');

-- 傾印  資料表 goat.drecords 結構
CREATE TABLE IF NOT EXISTS `drecords` (
  `Did` int(11) NOT NULL AUTO_INCREMENT,
  `Dunit` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `date` date NOT NULL,
  `Dcolumn` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Dwater` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `factor` float NOT NULL,
  `Dname` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `mid` int(11) NOT NULL,
  `Dcolumn2` varchar(50) NOT NULL,
  PRIMARY KEY (`Did`),
  KEY `FK_drecords_member` (`mid`),
  CONSTRAINT `FK_drecords_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- 正在傾印表格  goat.drecords 的資料：~5 rows (近似值)
REPLACE 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');

-- 傾印  資料表 goat.fcr 結構
CREATE TABLE IF NOT EXISTS `fcr` (
  `fid` int(11) NOT NULL AUTO_INCREMENT,
  `gid` int(255) DEFAULT NULL,
  `start` date DEFAULT NULL,
  `end` date DEFAULT NULL,
  `fcr` float DEFAULT NULL,
  PRIMARY KEY (`fid`),
  KEY `FK_fcr_goatdata` (`gid`),
  CONSTRAINT `FK_fcr_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.fcr 的資料：~5 rows (近似值)
REPLACE INTO `fcr` (`fid`, `gid`, `start`, `end`, `fcr`) VALUES
	(1, 185, '2024-05-01', '2024-05-04', 0.4),
	(2, 185, '2024-05-04', '2024-05-11', 0.1),
	(3, 21, '2024-05-04', '2024-05-11', 0.0666667),
	(4, 185, '2024-05-01', '2024-05-04', 0.4),
	(5, 185, '2024-05-01', '2024-05-11', 0.24);

-- 傾印  資料表 goat.feed 結構
CREATE TABLE IF NOT EXISTS `feed` (
  `fid` int(11) NOT NULL AUTO_INCREMENT,
  `fdate` date NOT NULL,
  `ftime` time NOT NULL,
  `fine` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `coarse` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `element` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `proportion` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `creep` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `mid` int(11) NOT NULL,
  `column` varchar(50) DEFAULT NULL,
  `district` varchar(255) DEFAULT NULL,
  `foodweight` int(11) DEFAULT NULL,
  `goatquantity` int(11) DEFAULT NULL,
  PRIMARY KEY (`fid`),
  KEY `FK_feed_member` (`mid`),
  CONSTRAINT `FK_feed_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- 正在傾印表格  goat.feed 的資料：~3 rows (近似值)
REPLACE 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, 'A1', 'A', 50, 20),
	(88, '2024-05-04', '13:44:00', '蘿蔔簽', '青貯', '蛋白質、水', '5:5', '無', 1, 'A1', 'A', 50, 50),
	(89, '2024-05-01', '05:54:00', '豆粉', '乾草', '蛋白質、水', '5:5', '無', 1, 'A1', 'A', 50, 20);

-- 傾印  資料表 goat.food 結構
CREATE TABLE IF NOT EXISTS `food` (
  `n` int(11) NOT NULL AUTO_INCREMENT,
  `fine` varchar(50) DEFAULT NULL,
  `coarse` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`n`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.food 的資料：~4 rows (近似值)
REPLACE INTO `food` (`n`, `fine`, `coarse`) VALUES
	(1, '豆粉', '青貯'),
	(2, NULL, '乾草'),
	(10, '蘿蔔簽', NULL),
	(11, NULL, '桑葉');

-- 傾印  資料表 goat.gcolumn 結構
CREATE TABLE IF NOT EXISTS `gcolumn` (
  `cid` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.gcolumn 的資料：~30 rows (近似值)
REPLACE 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'),
	(30, 'g1', 'g');

-- 傾印  資料表 goat.gcolumn_all 結構
CREATE TABLE IF NOT EXISTS `gcolumn_all` (
  `cid` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`cid`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.gcolumn_all 的資料：~6 rows (近似值)
REPLACE INTO `gcolumn_all` (`cid`, `name`) VALUES
	(1, 'A'),
	(2, 'B'),
	(3, 'C'),
	(4, 'D'),
	(5, 'E'),
	(6, 'F');

-- 傾印  資料表 goat.goatdata 結構
CREATE TABLE IF NOT EXISTS `goatdata` (
  `gid` int(11) NOT NULL AUTO_INCREMENT,
  `RFID` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `variety` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `gender` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Gage` date DEFAULT NULL,
  `unit` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `gcolumn` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `mid` int(11) NOT NULL,
  `mating` int(11) DEFAULT NULL,
  `source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `add_time` date DEFAULT NULL,
  `out` int(11) DEFAULT NULL,
  `meat` int(11) DEFAULT NULL,
  PRIMARY KEY (`gid`),
  KEY `FK_goatdata_member` (`mid`),
  CONSTRAINT `FK_goatdata_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

-- 傾印  資料表 goat.pedigree 結構
CREATE TABLE IF NOT EXISTS `pedigree` (
  `gid` varchar(50) DEFAULT NULL,
  `fgoat` varchar(50) DEFAULT NULL,
  `mgoat` varchar(50) DEFAULT NULL,
  `gn` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`gn`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.pedigree 的資料：~18 rows (近似值)
REPLACE 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', 'A000014', 'A000009', 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),
	('oxf7273', 'A000001', 'A000003', 21),
	('a132456', '0xf7273', 'A000003', 22),
	('0x1e454', 'A000005', 'A000022', 23),
	('0xf7453', 'A000005', 'A000003', 24),
	('0xf73a7', 'A000012', 'A000003', 25),
	('0xf8ac6', 'A000005', 'A000022', 26);

-- 傾印  資料表 goat.quality 結構
CREATE TABLE IF NOT EXISTS `quality` (
  `qid` int(11) NOT NULL AUTO_INCREMENT,
  `gid` int(11) NOT NULL DEFAULT 0,
  `diet` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Wintake` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `mid` int(11) NOT NULL,
  `out` int(11) DEFAULT NULL,
  PRIMARY KEY (`qid`),
  KEY `FK_quality_member` (`mid`),
  KEY `FK_quality_goatdata` (`gid`),
  CONSTRAINT `FK_quality_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  CONSTRAINT `FK_quality_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- 正在傾印表格  goat.quality 的資料：~2 rows (近似值)
REPLACE INTO `quality` (`qid`, `gid`, `diet`, `Wintake`, `mid`, `out`) VALUES
	(7, 24, '100', '100', 1, 0),
	(8, 28, '100', '100', 1, 0);

-- 傾印  資料表 goat.sensor 結構
CREATE TABLE IF NOT EXISTS `sensor` (
  `sid` int(11) NOT NULL AUTO_INCREMENT,
  `sensor_name` varchar(50) NOT NULL DEFAULT '0',
  `sensor_uid` varchar(50) NOT NULL DEFAULT '0',
  `num` int(11) NOT NULL,
  PRIMARY KEY (`sid`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.sensor 的資料：~4 rows (近似值)
REPLACE INTO `sensor` (`sid`, `sensor_name`, `sensor_uid`, `num`) VALUES
	(7, '區域三', ' PICO W', 1),
	(8, '區域四', ' PICO W', 2),
	(9, '區域五', ' PICO W', 3),
	(10, '區域六', ' PICO W', 4),
	(11, '區域七', ' PICO W', 5);

-- 傾印  資料表 goat.water 結構
CREATE TABLE IF NOT EXISTS `water` (
  `sn` int(11) NOT NULL AUTO_INCREMENT,
  `water` varchar(50) NOT NULL,
  PRIMARY KEY (`sn`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.water 的資料：~2 rows (近似值)
REPLACE INTO `water` (`sn`, `water`) VALUES
	(1, '衛可'),
	(2, '碘液');

-- 傾印  資料表 goat.weight 結構
CREATE TABLE IF NOT EXISTS `weight` (
  `wid` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `gid` int(11) NOT NULL DEFAULT 0,
  `weight` varchar(10) NOT NULL DEFAULT '',
  `mid` int(11) NOT NULL,
  `out` int(11) DEFAULT NULL,
  PRIMARY KEY (`wid`) USING BTREE,
  KEY `FK_weight_member` (`mid`),
  KEY `FK_weight_goatdata` (`gid`),
  CONSTRAINT `FK_weight_goatdata` FOREIGN KEY (`gid`) REFERENCES `goatdata` (`gid`),
  CONSTRAINT `FK_weight_member` FOREIGN KEY (`mid`) REFERENCES `member` (`mid`)
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

-- 正在傾印表格  goat.weight 的資料：~20 rows (近似值)
REPLACE 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),
	(52, '2024-05-01', 21, ' 60', 1, 0),
	(53, '2024-05-11', 21, ' 80', 1, 0),
	(54, '2024-05-11', 185, ' 75', 1, 0),
	(55, '2024-05-01', 185, ' 75', 1, 0),
	(56, '2024-05-04', 185, ' 90', 1, 0),
	(57, '2024-05-11', 185, ' 100', 1, 0),
	(58, '2024-05-04', 21, ' 60', 1, 0),
	(59, '2024-05-11', 21, ' 75', 1, 0);

