| 1 | |
| 2 | {{{ |
| 3 | #!sql |
| 4 | -- operations |
| 5 | -- changing format of column i |
| 6 | drop table if exists wrbd.operation_op; |
| 7 | |
| 8 | create table wrbd.operation_op ( |
| 9 | op_folio_no character varying(50), |
| 10 | op_st_id character varying(10), |
| 11 | ope_date date, |
| 12 | ope_year integer, |
| 13 | op_area numeric, |
| 14 | op_glass numeric, |
| 15 | op_elver numeric, |
| 16 | op_yellow numeric, |
| 17 | op_silver numeric, |
| 18 | op_not_recorded numeric, |
| 19 | op_eels_anaesthetized text, |
| 20 | op_num_fishing integer, |
| 21 | op_p1 integer, |
| 22 | op_p2 integer, |
| 23 | op_p3 integer, |
| 24 | op_p4 integer, |
| 25 | op_p5 integer, |
| 26 | op_total integer, |
| 27 | op_abundance_rating integer, |
| 28 | op_distribution character varying(15), |
| 29 | op_main_survey_target character varying(20), |
| 30 | opedisthwm numeric, |
| 31 | constraint c_fk_op_code FOREIGN KEY (op_st_id) REFERENCES wrbd.station_st(st_id) |
| 32 | ); |
| 33 | |
| 34 | |
| 35 | |
| 36 | copy wrbd.operation_op from 'C:/base/Operation_14_Eel_Db_MI_Rivers.csv' with csv delimiter as ';' ; |
| 37 | copy wrbd.operation_op from 'D:/CelineJouanin/POSEProject/Ireland/DataIreland/Operation_14_Eel_Db_MI_Rivers.csv' with csv delimiter as ';' ; |
| 38 | -- 966 lines |
| 39 | |
| 40 | alter table wrbd.operation_op add column op_nbsets numeric; |
| 41 | update wrbd.operation_op set op_nbsets=1; |
| 42 | alter table wrbd.operation_op rename column op_num_fishing to op_nb_pass; |
| 43 | alter table wrbd.operation_op add column op_density numeric; |
| 44 | alter table wrbd.operation_op add column op_equipment character varying(40); |
| 45 | update wrbd.operation_op set op_equipment='Handset'; |
| 46 | alter table wrbd.operation_op add column op_nbfem integer; |
| 47 | alter table wrbd.operation_op add column op_nbmal integer; |
| 48 | alter table wrbd.operation_op add column op_nbimmat integer; |
| 49 | alter table wrbd.operation_op add column op_nbind integer; |
| 50 | alter table wrbd.operation_op add column op_totalestim numeric; |
| 51 | alter table wrbd.operation_op add column op_totalweight numeric; |
| 52 | alter table wrbd.operation_op rename column ope_year to op_year; |
| 53 | alter table wrbd.operation_op rename column ope_date to op_date; |
| 54 | copy wrbd.operation_op(op_st_id,op_year,op_equipment,op_area,op_nbsets,op_nb_pass,op_density,op_totalestim,op_totalweight,op_total,op_nbfem,op_nbmal,op_nbimmat) from 'C:/base/8WFD_river_survey_operations.csv' with csv delimiter as ';' header ; |
| 55 | copy wrbd.operation_op from 'D:/CelineJouanin/POSEProject/Ireland/DataIreland/8WFD_river_survey_operations.csv' with csv delimiter as ';' ; |
| 56 | --984 lines |
| 57 | |
| 58 | alter table wrbd.operation_op add column op_id serial; |
| 59 | alter table wrbd.operation_op add constraint pk_wrbd_operation_op PRIMARY KEY (op_id); |
| 60 | alter table wrbd.operation_op add column op_nbnights integer; |
| 61 | alter table wrbd.operation_op add column op_nbnets integer; |
| 62 | alter table wrbd.operation_op add column op_cpue numeric; |
| 63 | alter table wrbd.operation_op rename column op_total to op_nbtotal; |
| 64 | |
| 65 | copy wrbd.operation_op(op_st_id,op_year,op_equipment,op_nbnights,op_nbnets,op_nbtotal,op_cpue,op_totalweight,op_nbfem,op_nbmal,op_nbimmat) from 'C:/base/8.lakes_operation.csv' with csv delimiter as ';' header ; |
| 66 | copy wrbd.operation_op(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 ; |
| 67 | }}} |