Advertisement
Guest User

Untitled

a guest
May 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ALTER TABLE ukbb.studies
  2.   ADD COLUMN study_id integer;
  3. ALTER TABLE ukbb.studies
  4.   DROP CONSTRAINT pk_studies;
  5.  
  6. update ukbb.studies set study_id = 1;
  7.  
  8. ALTER TABLE ukbb.studies
  9.   ADD CONSTRAINT pk_studies PRIMARY KEY (study_id);
  10.  
  11.  
  12. ALTER TABLE ukbb.analysis
  13.   ADD CONSTRAINT analysis_subjects_fk FOREIGN KEY (subject_id) REFERENCES ukbb.subjects (subject_id) ON UPDATE NO ACTION ON DELETE NO ACTION;
  14.  
  15. ALTER TABLE ukbb.analysis
  16.   ADD CONSTRAINT analysis_studies FOREIGN KEY (studies_id) REFERENCES ukbb.studies (study_id) ON UPDATE NO ACTION ON DELETE NO ACTION;
  17.  
  18. update ukbb.analysis set subject_id = 3 where uid=1;
  19. update ukbb.analysis set subject_id = 1 where uid=2;
  20. update ukbb.analysis set subject_id = 2 where uid=3;
  21.  
  22. update ukbb.analysis set studies_id = 1;
  23.  
  24.  
  25. ALTER TABLE ukbb.analysis
  26.   DROP COLUMN study_name;
  27.  
  28. ALTER TABLE ukbb.analysis
  29.   DROP COLUMN patientid;
  30.  
  31.  
  32. ALTER TABLE ukbb.lv_fc_timepoints
  33.   ADD CONSTRAINT timepoints_analysis FOREIGN KEY (analysisid) REFERENCES ukbb.analysis (uid) ON UPDATE NO ACTION ON DELETE NO ACTION;
  34.  
  35. ALTER TABLE ukbb.lv_fc_totals
  36.   ADD CONSTRAINT total_analysis FOREIGN KEY (totalsid) REFERENCES ukbb.analysis (uid) ON UPDATE NO ACTION ON DELETE NO ACTION;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement