sql - extra column in MySQL, can I drop it? -


i have database i'm creating , made 1 1 connection table in mysql, below screen shot. question can drop column (assembly factory_id) created when made connection? want single (factory_id) mess connection made? should drop (factory_id) , let connection stay? i'm noob, thanks!

enter image description here

i assuming comment "but should drop table?" meant "but should drop column?".

short answer: if safe, should delete column - there's no reason keep cluttering database , minds of future developers.

long answer: how determine if it's safe: if 1) value in factory_id , identical assembly factory_id, eg, duplicate value of each other, , 2) no other tables or program code refer assembly factory_id, can safely delete assembly factory_id.

however, if there's chance ever mean different things (not sample of 20 or rows), can't delete it. see fiddle: http://sqlfiddle.com/#!9/0bf17/1

if same, parts of database or code refer assembly factory_id, can refactor database or code parts refer factory_id instead , delete assembly factory_id.

when doing this, should make tests verify state of queries , programs after change same state before change.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -