text: use data_extracts;
  
  drop table if exists dataset1b;
  
  create table dataset1b (
    pseudo_id varchar(100) default NULL,
    MNDCode varchar(100),
    MNDDate varchar(100),
    MSCode varchar(100),
    MSDate varchar(100),
    ParkinsonsCode varchar(100),
    ParkinsonsDate varchar(100),
    AtypicalPDCode varchar(100),
    AtypicalPDDate varchar(100),
    VasDemCode varchar(100),
    VasDemDate varchar(100),
    AlzheimersCode varchar(100),
    AlzheimersDate varchar(100),
    DementiaQOFCode varchar(100),
    DementiaQOFDate varchar(100),
    CognitiveCode varchar(100),
    CognitiveDate varchar(100),
    MemoryCode varchar(100),
    MemoryDate varchar(100),
    BrainTumourCode varchar(100),
    BrainTumourDate varchar(100),
    BrainDamageCode varchar(100),
    BrainDamageDate varchar(100),
  
    ChromosomalAnomaliesCode varchar(100),
    ChromosomalAnomaliesDate varchar(100),
    EpilepsyCode varchar(100),
    EpilepsyDate varchar(100),
    PsychoticDisordersCode varchar(100),
    PsychoticDisordersDate varchar(100),
    BipolarCode varchar(100),
    BipolarDate varchar(100),
    DepressionCode varchar(100),
    DepressionDate varchar(100),
    AnxietyCode varchar(100),
    AnxietyDate varchar(100),
    PTSDCode varchar(100),
    PTSDDate varchar(100),
    OCDCode varchar(100),
    OCDDate varchar(100),
    PanicCode varchar(100),
    PanicDate varchar(100),
    SocialAnxietyCode varchar(100),
    SocialAnxietyDate varchar(100),
    PhobiasCode varchar(100),
    PhobiasDate varchar(100),
    SADCode varchar(100),
    SADDate varchar(100),
    ConversionCode varchar(100),
    ConversionDate varchar(100),
    AdjustmentCode varchar(100),
    AdjustmentDate varchar(100),
    SomatoformCode varchar(100),
    SomatoformDate varchar(100),
    EatingDisorderCode varchar(100),
    EatingDisorderDate varchar(100),
    DependenceAndAbuseCode varchar(100),
    DependenceAndAbuseDate varchar(100),
    ADHDCode varchar(100),
    ADHDDate varchar(100),
    PersonalityCode varchar(100),
    PersonalityDate varchar(100),
    HabitCode varchar(100),
    HabitDate varchar(100),
    LDCode varchar(100),
    LDDate varchar(100),
    AutismCode varchar(100),
    AutismDate varchar(100),
    SpeechAndlanguageCode varchar(100),
    SpeechAndlanguageDate varchar(100),
    ConductCode varchar(100),
    ConductDate varchar(100),
    TourettesCode varchar(100),
    TourettesDate varchar(100),
    GenderCode varchar(100),
    GenderDate varchar(100)
  );
  
  alter table dataset1b add index patientIdIdx (pseudo_id);
  
  insert into dataset1b (pseudo_id) select distinct group_by from cohort;
  