sql - Update query in Postgresql -
i have 2 tables in postgresql. 1 satetable having column statename , statecode , disttable having columns distname, statename , statecode. in disttable columns distname , statename populated. want update 'statecode' column in disttable. kindly help.
create table statetable (statename varchar, statecode varchar); create table disttable (distname varchar, statename varchar, statecode varchar); insert statetable values ('new york','ny'), ('nebraska','nb'), ('alaska','al'); insert disttable values ('king','new york', null), ('salt lake','nebraska', null), ('hanlulu','al', null);
corrcet me if wrong, think model should be:
create table statetable (statename varchar, statecode varchar); create table disttable (distname varchar, statecode varchar); insert statetable values ('new york','ny'), ('nebraska','nb'), ('alaska','al'); insert disttable values ('king','ny'), ('salt lake','nb'), ('hanlulu','al');
futhermore think wise have identification on disttable later can add other address tables.
Comments
Post a Comment