I'm not very experienced with database so sorry for lacking correct terminology.
I have a structure similar to
Employee
-Id
-Location
-Name
-StoreId
Store
-Id
-Name
And I want to simplify/refactor so that the store has the location rather than the employee. And all employees should all have the same location if they have the same storeId.
- How can I move location to Store while dropping location on Employee and setting it to the correct value?
- If somehow the locations are mismatching, can I use the one with the most hits?
Something like
ALTER TABLE store
add column location ???
alter table employee
drop column location