`number` column data type
Drewbie18 opened this issue · comments
First off I want to say thank you for putting this script together. I happen to be in the very same position you found yourself in, luckily you already did the work. Thank you!
I'm not sure what DB you are using but I wanted to mention a couple things and these are nit-picky bordering on the philosophical .
To get right to it, I think the number
column on the countries
table should be changed to VARCHAR(3) for the following reasons:
- ZEROFILL is deprecated for the SMALLINT in MySQL 8.0.17
- The number itself isn't exactly a number it's an assigned 'name' or code, that in some cases contains leading zeroes. To me this infers that it shouldn't be treated as a number, for instance you won't be doing calculations with it.
- Lastly and this is really more of a discussion; I think using ZEROFILL in order to ensure the data is properly preserved on insert seems wrong, the data is the data and shouldn't be altered by the DB.
I'll be using your script, I really just wanted to say thank you and make that suggestion.
Best regards.
Sounds reasonable to me! Any reason why you'd use VARCHAR
instead of CHAR
though?
No reason and I think, you're right CHAR
would be (more) correct as we know the length of the code will be 3.
Done! Thanks for the suggestion, and glad to hear it's useful for others 😊👍