sql - Update multiple tables with the same column -


i'm updating value in db locations of clinics. right have clinic column across multiple tables state city in. have 35 , compressed no space string (ie: fortsmith). i'm wanting retroactively adjust each of these values different format , use format going forward appending.

update transactions set clinic='07 - fort smith' clinic='fortsmith' 

the update simple, have 35 different locations , amount of tables share column clinic there way can have test against tables column clinic , update applies?

addressing need, rather exact question, solution normalization.

create clinic table, unique numeric clinicid, , varchar clinicname.

all tables have clinic column, should instead have clinicid foreign key referencing clinicid of clinic table.

all queries select column clinic pre-existing tables need changed include join table clinic, clinicname column.

the payoff when name of clinic changes, need change in clinic table, instead of in 35 different tables. queries clinic name joining clinic table automatically new clinic name without additional work on part.

there can valid reasons denormalizing, trade-off problem facing now. either normalize database design, or execute 35 queries every time need change clinic name.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -