CREATE TABLE IF NOT EXISTS `color_rows` (
`col_label` varchar(50) DEFAULT NULL,
`image` varchar(50) DEFAULT NULL,
`IL_Site` varchar(4) DEFAULT NULL,
`IL_Number` varchar(3) DEFAULT NULL,
`ROINumber` int(11) DEFAULT NULL,
`meanRed` decimal(6,3) DEFAULT NULL,
`stddevRed` decimal(6,3) DEFAULT NULL,
`minRed` int(3) DEFAULT NULL,
`maxRed` int(3) DEFAULT NULL,
`intDenRed` float DEFAULT NULL,
`skewRed` decimal(4,3) DEFAULT NULL,
`kurtRed` decimal(4,3) DEFAULT NULL,
`rawIntDensRed` int(11) DEFAULT NULL,
`meanGreen` float DEFAULT NULL,
`stddevGreen` float DEFAULT NULL,
`minGreen` int(3) DEFAULT NULL,
`maxGreen` int(3) DEFAULT NULL,
`intDenGreen` float DEFAULT NULL,
`skewGreen` float DEFAULT NULL,
`kurtGreen` float DEFAULT NULL,
`rawIntDensGreen` int(10) DEFAULT NULL,
`meanBlue` float DEFAULT NULL,
`stddevBlue` float DEFAULT NULL,
`minBlue` int(3) DEFAULT NULL,
`maxBlue` int(3) DEFAULT NULL,
`intDenBlue` float DEFAULT NULL,
`skewBlue` float DEFAULT NULL,
`kurtBlue` float DEFAULT NULL,
`rawIntDensBlue` int(10) DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `color_cleaner`
ADD `IL_Site` VARCHAR( 4 ) NULL DEFAULT NULL AFTER `label` ,
ADD `IL_Number` VARCHAR( 3 ) NULL DEFAULT NULL AFTER `IL_Site`,
ADD `ROINumber` VARCHAR( 4 ) NULL DEFAULT NULL AFTER `IL_Number`;
UPDATE color_cleaner SET `IL_Site`=LEFT(label,4);
UPDATE color_cleaner SET `IL_Number`=MID(label,6,3);
UPDATE color_cleaner SET ROINumber=MID(label,36,4);
SELECT * FROM color_cleaner WHERE label LIKE "%.W.201%%"
UPDATE color_cleaner SET ROINumber=MID(label,38,4) WHERE label LIKE "%.N.201%%";
UPDATE color_cleaner SET ROINumber=MID(label,38,4) WHERE label LIKE "%.S.201%%";
UPDATE color_cleaner SET ROINumber=MID(label,38,4) WHERE label LIKE "%.E.201%%";
UPDATE color_cleaner SET ROINumber=MID(label,38,4) WHERE label LIKE "%.W.201%%";
CREATE TABLE colormorph SELECT * FROM PON_Occ_Data;
ALTER TABLE `color_cleaner` ADD INDEX ( `channel` );
DROP TABLE IF EXISTS color_rows;
SELECT label, IL_Site, IL_Number, ROINumber,
rawintden AS rawIntDensRed
ADD `meanGreen` FLOAT NULL DEFAULT NULL ,
ADD `stddevGreen` FLOAT NULL DEFAULT NULL ,
ADD `minGreen` INT( 3 ) NULL DEFAULT NULL ,
ADD `maxGreen` INT( 3 ) NULL DEFAULT NULL ,
ADD `intDenGreen` FLOAT NULL DEFAULT NULL ,
ADD `skewGreen` FLOAT NULL DEFAULT NULL ,
ADD `kurtGreen` FLOAT NULL DEFAULT NULL ,
ADD `rawIntDensGreen` INT( 10 ) NULL DEFAULT NULL ;
ADD `meanBlue` FLOAT NULL DEFAULT NULL ,
ADD `stddevBlue` FLOAT NULL DEFAULT NULL ,
ADD `minBlue` INT( 3 ) NULL DEFAULT NULL ,
ADD `maxBlue` INT( 3 ) NULL DEFAULT NULL ,
ADD `intDenBlue` FLOAT NULL DEFAULT NULL ,
ADD `skewBlue` FLOAT NULL DEFAULT NULL ,
ADD `kurtBlue` FLOAT NULL DEFAULT NULL ,
ADD `rawIntDensBlue` INT( 10 ) NULL DEFAULT NULL ;
ALTER TABLE `color_rows` ADD INDEX ( `IL_Site` );
ALTER TABLE `color_rows` ADD INDEX ( `IL_Number` );
ALTER TABLE `color_rows` ADD INDEX ( `ROINumber` );
ALTER TABLE `color_cleaner` ADD INDEX ( `IL_Site` );
ALTER TABLE `color_cleaner` ADD INDEX ( `IL_Number` );
ALTER TABLE `color_cleaner` ADD INDEX ( `ROINumber` );
UPDATE color_rows, color_cleaner
rawIntDensGreen=rawintden
WHERE color_rows.IL_Site=color_cleaner.IL_Site
AND color_rows.IL_Number=color_cleaner.IL_Number
AND color_rows.ROINumber=color_cleaner.ROINumber
AND color_cleaner.channel="green";
UPDATE color_rows, color_cleaner
WHERE color_rows.IL_Site=color_cleaner.IL_Site
AND color_rows.IL_Number=color_cleaner.IL_Number
AND color_rows.ROINumber=color_cleaner.ROINumber
AND color_cleaner.channel="blue";
CREATE TABLE color_rows2 SELECT * FROM color_rows GROUP BY label;
DROP TABLE IF EXISTS color_rows;
RENAME TABLE `PON_2020_MASTER`.`color_rows2` TO `PON_2020_MASTER`.`color_rows` ;