| 3 | |
| 4 | {{{ |
| 5 | #!sql |
| 6 | drop table if exists wrbd.fish_fi; |
| 7 | |
| 8 | create table wrbd.fish_fi ( |
| 9 | fi_folio_no character varying(50), |
| 10 | fi_st_id character varying(10), |
| 11 | fi_fish_id character varying(10), |
| 12 | fi_date date, |
| 13 | fi_year integer, |
| 14 | fi_individual_life character varying(10), |
| 15 | fi_retained character varying(10), |
| 16 | fi_length numeric |
| 17 | ); |
| 18 | |
| 19 | |
| 20 | copy wrbd.fish_fi from 'C:/base/Operation_fish_14_Eel_Db_MI_Rivers.csv' with csv delimiter as ';' ; |
| 21 | copy wrbd.fish_fi from 'D:/CelineJouanin/POSEProject/Ireland/DataIreland/Operation_fish_14_Eel_Db_MI_Rivers.csv' with csv delimiter as ';' header; |
| 22 | copy wrbd.fish_fi(op_st_id,op_year,op_equipment,op_nbnights,op_nbnets,op_nbtotal,op_cpue,op_totalweight,op_nbfem,op_nbmal,op_nbimmat) from 'D:/CelineJouanin/POSEProject/Ireland/DataIreland/8.lakes_operation.csv' with csv delimiter as ';' header ; |
| 23 | |
| 24 | }}} |
| 25 | |
| 26 | {{ |
| 27 | --1016 lines |
| 28 | alter table wrbd.fish_fi rename column fi_id to fi_fishid; |
| 29 | alter table wrbd.fish_fi add column fi_id serial PRIMARY KEY; |
| 30 | |
| 31 | -- pour aller rajouter les op_id dans la table poissons |
| 32 | select * from wrbd.operation_op order by op_date; -- un pb de date |
| 33 | update wrbd.operation_op set op_date='2009-09-27' where op_date='0009-09-27' |
| 34 | select * from wrbd.fish_fi left join (select * from wrbd.operation_op where op_nbtotal>0)as ope |
| 35 | on (fi_date,fi_st_id)=(ope.op_date,ope.op_st_id) ; --2357 |
| 36 | select count(*) from wrbd.fish_fi; -- 2208 |
| 37 | -- voir les changements dans operation pour règler le pb de jointure |
| 38 | }}} |