SSARHERPS / SSAR-species-database

SSAR North American Common Names Database
http://ssarherps.org/cndb/
GNU General Public License v3.0
2 stars 0 forks source link

batch update Taxon Credit Date #49

Closed mkoo closed 9 years ago

mkoo commented 9 years ago

What is needed to batch update the Taxon Credit Date? Can you do an SQL insert with something like:

where taxon_credit_date IS NULL and taxon_credit = "Brian I. Crother (Chair), Jeff Boundy, Frank T. Burbrink, Jonathan A. Campbell, R. Alexander Pyron" INSERT taxon_credit_date = "2014-12-12" of something along those lines....

I am doing all dates in ISO format. Let me know requirements and I will supply all the statements!

tigerhawkvok commented 9 years ago

Right now, the credit date has no formatting requirements, especially in case an odd date or relative date (or date span) has to be used. Thoughts?

tigerhawkvok commented 9 years ago

Ran

UPDATE `north_american_species` SET `taxon_credit_date`="2014-12-12" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Brian I. Crother (Chair), Jeff Boundy, Frank T. Burbrink, Jonathan A. Campbell, R. Alexander Pyron")
tigerhawkvok commented 9 years ago

Can one of you guys update all the snakes to have the Taxon Credit date to 2014-12-12 and add the Taxon credit of Brian I. Crother (Chair), Jeff Boundy, Frank T. Burbrink, Jonathan A. Campbell, R. Alexander Pyron for all (it doesn't seem like this has been done for all snakes, not sure Michelle got through all the M-Z ones)?

Ran

UPDATE `north_american_species` SET `taxon_credit_date`="2014-12-12", `taxon_credit`="Brian I. Crother (Chair), Jeff Boundy, Frank T. Burbrink, Jonathan A. Campbell, R. Alexander Pyron" WHERE (`taxon_credit` IS NULL AND `linnean_order`="serpentes" )
mkoo commented 9 years ago

More updates to run:

UPDATE `north_american_species` SET `taxon_credit_date`="2014-07-10" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Stephen G. Tilley (Chair), Richard Highton, David B. Wake" AND `taxon_credit` IS NULL AND `linnean_order`="caudata" )

and

UPDATE `north_american_species` SET `taxon_credit_date`="2015-01-15" WHERE (`taxon_credit_date`="" AND `taxon_credit`="John B. Iverson (Chair), Peter A. Meylan, Michael E. Seidel" AND `taxon_credit` IS NULL AND `linnean_order`="testudines" )

and

UPDATE `north_american_species` SET `taxon_credit_date`="2015-01-26" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Kevin de Quieroz (Chair) and Tod W. Reeder" AND `taxon_credit` IS NULL AND `linnean_order`="squamata" )

and

UPDATE `north_american_species` SET `taxon_credit_date`="2014-12-22" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Darrel R. Frost, David M. Green, Emily Moriarty Lemmon, Roy W. McDiarmid, and Joseph R. Mendelson III" AND `taxon_credit` IS NULL AND `linnean_order`="anura" )
tigerhawkvok commented 9 years ago

Original SQL was malformed:

UPDATE `north_american_species` SET `taxon_credit_date`="2015-01-15" WHERE (`taxon_credit_date`="" AND `taxon_credit`="John B. Iverson (Chair), Peter A. Meylan, Michael E. Seidel" WHERE (`taxon_credit` IS NULL AND `linnean_order`="testudines" )

(note mismatching parentheses and double WHERE clause). Made into valid but nonsensical commands in edit to @mkoo 's post above (asking for an AND of null/specific taxon_credit). Ended up running:

UPDATE `north_american_species` SET `taxon_credit_date`="2014-07-10" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Stephen G. Tilley (Chair), Richard Highton, David B. Wake" AND `linnean_order`="caudata" );

UPDATE `north_american_species` SET `taxon_credit_date`="2015-01-15" WHERE (`taxon_credit_date`="" AND `taxon_credit`="John B. Iverson (Chair), Peter A. Meylan, Michael E. Seidel" AND `linnean_order`="testudines" );

UPDATE `north_american_species` SET `taxon_credit_date`="2015-01-26" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Kevin de Quieroz (Chair) and Tod W. Reeder" AND `linnean_order`="squamata" );

UPDATE `north_american_species` SET `taxon_credit_date`="2014-12-22" WHERE (`taxon_credit_date`="" AND `taxon_credit`="Darrel R. Frost, David M. Green, Emily Moriarty Lemmon, Roy W. McDiarmid, and Joseph R. Mendelson III" AND `linnean_order`="anura" );

Getting back

UPDATE  `north_american_species` SET  `taxon_credit_date` =  "2014-07-10" WHERE (
`taxon_credit_date` =  "" AND  `taxon_credit` =  "Stephen G. Tilley (Chair), Richard Highton, David B. Wake" AND  `linnean_order` =  "caudata"
);# 36 rows affected.
UPDATE  `north_american_species` SET  `taxon_credit_date` =  "2015-01-15" WHERE (
`taxon_credit_date` =  "" AND  `taxon_credit` =  "John B. Iverson (Chair), Peter A. Meylan, Michael E. Seidel" AND  `linnean_order` =  "testudines"
);# 48 rows affected.
UPDATE  `north_american_species` SET  `taxon_credit_date` =  "2015-01-26" WHERE (
`taxon_credit_date` =  "" AND  `taxon_credit` =  "Kevin de Quieroz (Chair) and Tod W. Reeder" AND  `linnean_order` =  "squamata"
);# 215 rows affected.
UPDATE  `north_american_species` SET  `taxon_credit_date` =  "2014-12-22" WHERE (
`taxon_credit_date` =  "" AND  `taxon_credit` = "Darrel R. Frost, David M. Green, Emily Moriarty Lemmon, Roy W. McDiarmid, and Joseph R. Mendelson III" AND  `linnean_order` =  "anura"
);# 107 rows affected.
mkoo commented 9 years ago

OK thanks (sorry for the typo-filled sql-- blame it on Warriors game!). Looks good, so closing.